UNPKG

@area17/a17-boilerplate

Version:

The official AREA 17 boilerplate

54 lines (46 loc) 1.35 kB
const path = require('path'); const argv = require('minimist')(process.argv.slice(2)); const webpack = require('webpack'); const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); const data = require(path.resolve('frontend', 'manifest.json')); // fixme : it should use getManifestPath() in utils.js const scriptsPath = path.resolve('frontend', 'js'); let config = { entry: { head: path.resolve(scriptsPath, 'head.js'), app: path.resolve(scriptsPath, 'app.js') }, output: { filename: '[name].js', path: path.resolve(data.paths.dist,'scripts') }, module: { rules: [ { test: /\.js$/, exclude: /node_modules\/(?!(@antoine_a17|@gulp-sourcemaps|)\/).*/, loader: require.resolve('babel-loader'), options: { babelrc: false, presets: [require.resolve('babel-preset-env')], cacheDirectory: true } } ] }, devtool: 'source-map', plugins: [ new HardSourceWebpackPlugin() ] }; module.exports = (env, argv) => { console.log('Production: ', env.prod); if (env.prod) { config.module.rules[0].options.compact = true; config.plugins.push(new webpack.optimize.UglifyJsPlugin({ comments: false, beautify: false })); // no sourcemap on production config.devtool = false; } return config; };