Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created October 26, 2016 15:39
Show Gist options
  • Select an option

  • Save ajcrites/bc8cb18025d7a8c72946d41db6b445d8 to your computer and use it in GitHub Desktop.

Select an option

Save ajcrites/bc8cb18025d7a8c72946d41db6b445d8 to your computer and use it in GitHub Desktop.
const webpack = require("webpack");
const HtmlPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const helpers = require("./helpers");
const envPlugin = new webpack.DefinePlugin({
"ENV": JSON.stringify("bar")
});
module.exports = {
entry: {
polyfills: "./src/polyfills.ts",
vendor: "./src/vendor.ts",
app: "./src/main.ts",
},
resolve: {
extensions: ["", ".ts", ".js"]
},
module: {
plugins: [
envPlugin
],
loaders: [
{
test: /\.ts$/,
loaders: ["awesome-typescript-loader", "angular2-template-loader"],
},
{
test: /\.html$/,
loader: "html",
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: "file?name=assets/[name].[hash].[ext]",
},
{
test: /\.css$/,
exclude: helpers.root("src", "app"),
loader: ExtractTextPlugin.extract("style", "css?sourceMap")
},
{
test: /\.css$/,
include: helpers.root("src", "app"),
loader: "raw",
},
],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: ["app", "vendor", "polyfills"]
}),
new HtmlPlugin({
template: "src/index.html",
}),
],
};
@ajcrites
Copy link
Copy Markdown
Author

Issue here is that plugins is separate from module. It would also end up being defined twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment