Last active
February 20, 2018 16:23
-
-
Save petvas/0f65819da7685f26c0b947538b046757 to your computer and use it in GitHub Desktop.
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; | |
const ManifestPlugin = require('webpack-manifest-plugin'); | |
const CleanWebpackPlugin = require('clean-webpack-plugin'); | |
plugins = [ | |
new webpack.EnvironmentPlugin(['NODE_ENV']), | |
new ManifestPlugin(), | |
new CleanWebpackPlugin([__dirname + '/src/Website/Scripts/dist']), | |
]; | |
if (process.env.NODE_ENV === "production") { | |
plugins.push(new webpack.optimize.ModuleConcatenationPlugin({ optimizationBailout: true })); | |
} else { | |
Array.prototype.push.apply(plugins, [ | |
new BundleAnalyzerPlugin(), | |
new webpack.NamedModulesPlugin(), | |
new webpack.NamedChunksPlugin() | |
]); | |
} | |
module.exports = { | |
context: __dirname + "/src/Website/Scripts/", | |
entry: "./src/app.js", | |
output: { path: __dirname + "/src/Website/Scripts/dist", filename: "[name].[chunkhash].js", publicPath: '/Scripts/dist/' }, | |
plugins: plugins, | |
module: { | |
rules: [ | |
{ | |
enforce: 'pre', | |
test: /\.js$/, | |
exclude: /node_modules/, | |
include: [ | |
path.resolve(__dirname, './src') | |
], | |
options: { | |
configFile: path.resolve(__dirname, './.eslintrc'), | |
failOnError: true, | |
//failOnWarning: true, | |
}, | |
loader: 'eslint-loader', | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
include: [ | |
path.resolve(__dirname, './src') | |
], | |
loader: "babel-loader", // or just "babel" | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment