Created
June 22, 2016 20:48
-
-
Save mreis1/11b6b6be16e753a0f4ff4e2dfc50bc37 to your computer and use it in GitHub Desktop.
Webpack Configuration
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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"removeComments": false, | |
"noImplicitAny": false, | |
"suppressImplicitAnyIndexErrors": true, | |
"declaration": false | |
}, | |
"exclude": [ | |
"node_modules", | |
"typings/main", | |
"typings/main.d.ts" | |
] | |
} |
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
{ | |
"globalDependencies": { | |
"core-js": "registry:dt/core-js#0.0.0+20160317120654", | |
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446", | |
"node": "registry:dt/node#4.0.0+20160509154515" | |
} | |
} |
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
module.exports = { | |
//... | |
resolve: { | |
//... | |
alias: { | |
'lessFolder': './../less', | |
'vendorDir': './../vendor', | |
'mocksFolder': './../assets/mocks', | |
'modernizr$': path.resolve(__dirname, "../.modernizrrc") | |
} | |
}, | |
module: { | |
loaders: [ | |
//convert .ts into .js | |
{ | |
test: /\.ts$/, | |
loader: 'ts' | |
}, | |
//html files | |
{ | |
test: /\.html$/, | |
loader: 'html' | |
}, | |
{ | |
test:/\.modernizrrc$/, | |
loader: "modernizr" | |
} | |
] | |
}, | |
plugins: [ | |
//... | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery", | |
"window.jQuery": "jquery", | |
"_": "underscore", | |
"underscore": "underscore" | |
//'process.env.NODE_ENV': '"development"' | |
}), | |
//https://github.com/peerigon/modernizr-loader#modernizr-loader-for-webpack | |
new webpack.ResolverPlugin( | |
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main']) | |
), | |
new HtmlWebpackPlugin({ | |
template: 'src/index.html' | |
}) | |
] | |
}; |
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
module.exports = webpackMerge(commonConfig, { | |
devtool: 'cheap-module-eval-source-map', | |
output: { | |
path: helpers.root('dist'), | |
publicPath: 'http://localhost:8080/', | |
filename: '[name].js', | |
chunkFilename: '[id].chunk.js' | |
}, | |
plugins: [ | |
new ExtractTextPlugin('[name].css') | |
], | |
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
module.exports = webpackMerge(commonConfig, { | |
devtool: 'source-map', | |
output: { | |
path: helpers.root('dist'), | |
publicPath: '/', | |
filename: '[name].[hash].js', | |
chunkFilename: '[id].[hash].chunk.js' | |
}, | |
htmlLoader: { | |
minimize: false // workaround for ng2 | |
}, | |
plugins: [ | |
//https://github.com/webpack/docs/wiki/list-of-plugins#noerrorsplugin | |
new webpack.NoErrorsPlugin(), | |
//https://github.com/webpack/docs/wiki/list-of-plugins#dedupeplugin | |
new webpack.optimize.DedupePlugin(), | |
//https://github.com/webpack/docs/wiki/list-of-plugins#uglifyjsplugin | |
new webpack.optimize.UglifyJsPlugin(), | |
//https://github.com/webpack/extract-text-webpack-plugin#usage-example-with-css | |
new ExtractTextPlugin('[name].[hash].css'), | |
//https://webpack.github.io/docs/list-of-plugins.html#defineplugin | |
new webpack.DefinePlugin({ | |
'process.env': { | |
'ENV': JSON.stringify(ENV) | |
} | |
}) | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment