var path = require('path'); var webpack = require('webpack'); var UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const extractSass = new ExtractTextPlugin({ filename: "[name].css", disable: process.env.NODE_ENV === "development" }); var mod_common = { rules: [ { test: /\.css$/, use: [ 'vue-style-loader', 'css-loader' ], }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: {} // other vue-loader options go here } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.(png|jpg|gif)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }, { test: /\.svg$/, loader: 'vue-svg-loader', // `vue-svg` for webpack 1.x options: { // optional [svgo](https://github.com/svg/svgo) options svgo: { plugins: [ {removeDoctype: true}, {removeComments: true} ] } } } ] }; module.exports = { name: "main", entry: './webpack/main.js', output: { path: path.resolve(__dirname, './public_html/js'), publicPath: '/js/', filename: 'bundle.js' }, module: mod_common, devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false } if (process.env.NODE_ENV === 'production') { // http://vue-loader.vuejs.org/en/workflow/production.html module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new UglifyJSPlugin({ sourceMap: true }), new webpack.LoaderOptionsPlugin({ minimize: true }) ]) }