reindent webpack-config, allow absolute paths for including modules, automatically resolve file extensions

This commit is contained in:
2017-08-30 12:55:11 +02:00
parent ead67e1e88
commit 60dc5e2603

View File

@@ -13,63 +13,61 @@ var env = process.env.WEBPACK_ENV;
// Differ settings based on production flag // Differ settings based on production flag
if (env === 'production') { if (env === 'production') {
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
plugins.push(new UglifyJsPlugin({ plugins.push(new UglifyJsPlugin({
minimize: true, minimize: true,
sourceMap: true sourceMap: true
} }
)); ));
plugins.push(new webpack.DefinePlugin({ plugins.push(new webpack.DefinePlugin({
'process.env': { 'process.env': {
NODE_ENV: '"production"' NODE_ENV: '"production"'
} }
} }
)); ));
appName = appName + '.js'; appName = appName + '.js';
} else { } else {
appName = appName + '.js'; appName = appName + '.js';
} }
// Main Settings config // Main Settings config
module.exports = { module.exports = {
entry: [ entry: [
'intersection-observer', 'intersection-observer',
'babel-polyfill', 'babel-polyfill',
entryPoint entryPoint
], ],
devtool: 'source-map', devtool: 'source-map',
output: { output: {
path: exportPath, path: exportPath,
publicPath: '/build', publicPath: '/build',
filename: appName filename: appName
}, },
module: { module: {
loaders: [ loaders: [{
{ test: /\.(vue|js)$/,
test: /\.(vue|js)$/, loader: 'eslint-loader',
loader: 'eslint-loader', exclude: /node_modules/
exclude: /node_modules/ }, {
}, test: /\.vue$/,
{ loader: 'vue-loader'
test: /\.vue$/, }, {
loader: 'vue-loader' test: /\.js$/,
}, exclude: /(node_modules|bower_components)/,
{ loader: 'babel-loader',
test: /\.js$/, query: {
exclude: /(node_modules|bower_components)/, presets: ['es2015']
loader: 'babel-loader', }
query: { }]
presets: ['es2015'] },
} resolve: {
} alias: {
] 'vue$': 'vue/dist/vue.esm.js'
}, },
resolve: { modules: [path.resolve(__dirname, "src"), "node_modules"],
alias: { extensions: [".vue", ".js", ".less"]
'vue$': 'vue/dist/vue.esm.js' },
} plugins
},
plugins
}; };