diff options
Diffstat (limited to 'ng2-component-lab.webpack.config.js')
-rw-r--r-- | ng2-component-lab.webpack.config.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ng2-component-lab.webpack.config.js b/ng2-component-lab.webpack.config.js new file mode 100644 index 0000000..d2f0551 --- /dev/null +++ b/ng2-component-lab.webpack.config.js @@ -0,0 +1,62 @@ +var path = require('path'); +var HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin') +var baseHref = process.env.NODE_ENV === 'build' ? '<base href="/angular/">' : '<base href="">' + +var webpackConfig = { + + devtool: 'source-map', + + output: { + path: path.resolve('.out/angular'), + publicPath: '' + }, + + plugins: [ + new HtmlReplaceWebpackPlugin([{ + pattern: '<base href="/">', + replacement: baseHref + }]) + ], + + module: { + rules: [ + // .ts files for TypeScript + { + test: /.ts$/, + use: [ + 'awesome-typescript-loader', + 'angular2-template-loader', + 'angular2-router-loader' + ] + }, + { test: /\.html$/, loader: "html-loader" }, + { + test: /.scss$/, + use: ['style-loader', 'css-loader', 'sass-loader'], + include: path.resolve(__dirname, '../') + }, + ] + }, + + resolve: { + extensions: ['.ts', '.js'], + modules: [path.resolve(__dirname, 'node_modules')], + alias: { + root: path.resolve(__dirname), + app: path.resolve(__dirname, 'src') + } + }, + + node: { + global: true, + crypto: 'empty', + __dirname: true, + __filename: true, + process: true, + Buffer: false, + clearImmediate: false, + setImmediate: false + } +}; + +module.exports = webpackConfig; |