forked from bvthuan/ces-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from viettrannetc/dev-fake-be
Dev fake be
- Loading branch information
Showing
55 changed files
with
20,576 additions
and
4,750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
server: { | ||
baseDir: './dist', | ||
middleware: { | ||
1: require('connect-history-api-fallback')({ index: '/index.html', verbose: true }) | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const _root = path.resolve(__dirname, '..'); | ||
|
||
function root(args) { | ||
args = Array.prototype.slice.call(arguments, 0); | ||
|
||
return path.join.apply(path, [_root].concat(args)); | ||
} | ||
|
||
exports.root = root; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
const webpack = require('webpack'); | ||
const CleanWebpackPlugin = require('clean-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
|
||
const helpers = require('./helpers'); | ||
const isDev = process.env.NODE_ENV !== 'production'; | ||
|
||
module.exports = { | ||
entry: { | ||
vendor: './src/vendor.ts', | ||
polyfills: './src/polyfills.ts', | ||
main: isDev ? './src/main.ts' : './src/main.aot.ts' | ||
}, | ||
|
||
resolve: { | ||
extensions: ['.ts', '.js', '.scss'] | ||
}, | ||
|
||
module: { | ||
rules: [{ | ||
test: /\.html$/, | ||
loader: 'html-loader' | ||
}, | ||
{ | ||
test: /\.(png|svg|jpg|gif)$/, | ||
use: [ | ||
'file-loader' | ||
] | ||
}, | ||
{ | ||
test: /\.(scss|sass)$/, | ||
use: [ | ||
{ loader: 'style-loader', options: { sourceMap: isDev } }, | ||
{ loader: 'css-loader', options: { sourceMap: isDev } }, | ||
{ loader: 'sass-loader', options: { sourceMap: isDev } } | ||
], | ||
include: helpers.root('src', 'assets') | ||
}, | ||
{ | ||
test: /\.(scss|sass)$/, | ||
use: [ | ||
'to-string-loader', | ||
{ loader: 'css-loader', options: { sourceMap: isDev } }, | ||
{ loader: 'sass-loader', options: { sourceMap: isDev } } | ||
], | ||
include: helpers.root('src', 'app') | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new CleanWebpackPlugin( | ||
helpers.root('dist'), { root: helpers.root(), verbose: true }), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: 'src/index.html' | ||
}), | ||
|
||
new CopyWebpackPlugin([ | ||
{ from: 'src/assets', to: 'assets' } | ||
]), | ||
|
||
new webpack.DefinePlugin({ | ||
// global app config object | ||
config: JSON.stringify({ | ||
apiUrl: isDev ? 'https://localhost:44301' : 'https://wa-tlvn.azurewebsites.net', | ||
}) | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
const webpackMerge = require('webpack-merge'); | ||
const commonConfig = require('./webpack.config.common'); | ||
const helpers = require('./helpers'); | ||
|
||
module.exports = webpackMerge(commonConfig, { | ||
mode: 'development', | ||
|
||
devtool: 'cheap-module-eval-source-map', | ||
|
||
output: { | ||
path: helpers.root('dist'), | ||
publicPath: '/', | ||
filename: '[name].bundle.js', | ||
chunkFilename: '[id].chunk.js' | ||
}, | ||
|
||
optimization: { | ||
noEmitOnErrors: true | ||
}, | ||
|
||
module: { | ||
rules: [{ | ||
test: /\.ts$/, | ||
loaders: [{ | ||
loader: 'awesome-typescript-loader', | ||
options: { | ||
configFileName: helpers.root('tsconfig.json') | ||
} | ||
}, | ||
'angular2-template-loader', | ||
'angular-router-loader', | ||
], | ||
exclude: [/node_modules/], | ||
}] | ||
}, | ||
|
||
devServer: { | ||
historyApiFallback: true, | ||
stats: 'minimal', | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict'; | ||
|
||
const webpackMerge = require('webpack-merge'); | ||
const ngw = require('@ngtools/webpack'); | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | ||
const cssnano = require('cssnano'); | ||
|
||
const commonConfig = require('./webpack.config.common'); | ||
const helpers = require('./helpers'); | ||
|
||
module.exports = webpackMerge(commonConfig, { | ||
mode: 'production', | ||
|
||
output: { | ||
path: helpers.root('dist'), | ||
publicPath: '/', | ||
filename: '[hash].js', | ||
chunkFilename: '[id].[hash].chunk.js', | ||
}, | ||
|
||
optimization: { | ||
noEmitOnErrors: true, | ||
splitChunks: { | ||
chunks: 'all' | ||
}, | ||
runtimeChunk: 'single', | ||
minimizer: [ | ||
new UglifyJsPlugin({ | ||
cache: true, | ||
parallel: true, | ||
}), | ||
|
||
new OptimizeCSSAssetsPlugin({ | ||
cssProcessor: cssnano, | ||
cssProcessorOptions: { | ||
discardComments: { | ||
removeAll: true | ||
} | ||
}, | ||
canPrint: false, | ||
}), | ||
] | ||
}, | ||
|
||
module: { | ||
rules: [{ | ||
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, | ||
loader: '@ngtools/webpack', | ||
}, ], | ||
}, | ||
|
||
plugins: [ | ||
new ngw.AngularCompilerPlugin({ | ||
tsConfigPath: helpers.root('tsconfig.aot.json'), | ||
entryModule: helpers.root('src', 'app', 'app.module#AppModule'), | ||
}), | ||
], | ||
}); |
Oops, something went wrong.