Created
September 5, 2016 14:20
-
-
Save awerlang/5d1dfc41e5db10f16ceaac80406d62e8 to your computer and use it in GitHub Desktop.
webpack dev config for Angular 2 / Typescript
This file contains hidden or 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
var webpack = require('webpack'); | |
var path = require('path'); | |
// Webpack Config | |
var webpackConfig = { | |
entry: { | |
'polyfills': './src/polyfills.browser.ts', | |
'vendor': './src/vendor.browser.ts', | |
'main': './src/main.browser.ts', | |
}, | |
output: { | |
path: './dist', | |
}, | |
module: { | |
loaders: [ | |
// .ts files for TypeScript | |
{ test: /\.ts$/, loaders: ['awesome-typescript-loader', 'angular2-template-loader'] }, | |
{ test: /\.css$/, loaders: ['to-string-loader', 'css-loader'] }, | |
{ test: /\.html$/, loader: 'raw-loader' } | |
] | |
} | |
}; | |
// Our Webpack Defaults | |
var defaultConfig = { | |
devtool: 'cheap-module-source-map', | |
cache: true, | |
debug: true, | |
output: { | |
filename: '[name].bundle.js', | |
sourceMapFilename: '[name].map', | |
chunkFilename: '[id].chunk.js' | |
}, | |
resolve: { | |
root: [ path.join(__dirname, 'src') ], | |
extensions: ['', '.ts', '.js'] | |
}, | |
devServer: { | |
historyApiFallback: true, | |
watchOptions: { aggregateTimeout: 300, poll: 1000 } | |
}, | |
node: { | |
global: 1, | |
crypto: 'empty', | |
module: 0, | |
Buffer: 0, | |
clearImmediate: 0, | |
setImmediate: 0 | |
} | |
}; | |
var webpackMerge = require('webpack-merge'); | |
module.exports = webpackMerge(defaultConfig, webpackConfig); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment