var path = require('path'); var webpack = require('webpack'); 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|svg)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } } ] }; module.exports = [ { name: "home", entry: './webpack/page/home.js', output: { path: path.resolve(__dirname, './public_html/js/bundle'), publicPath: '/js/bundle/', filename: 'home@0.js' }, module: mod_common, devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false }, { name: "teacher", entry: './webpack/page/teacher.js', output: { path: path.resolve(__dirname, './public_html/js/bundle'), publicPath: '/js/bundle/', filename: 'teacher@0.js' }, module: mod_common, devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false }, { name: "ue", entry: './webpack/page/ue.js', output: { path: path.resolve(__dirname, './public_html/js/bundle'), publicPath: '/js/bundle/', filename: 'ue@0.js' }, module: mod_common, devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false }, { name: "settings", entry: './webpack/page/settings.js', output: { path: path.resolve(__dirname, './public_html/js/bundle'), publicPath: '/js/bundle/', filename: 'settings@0.js' }, module: mod_common, devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false }, { name: "login", entry: './webpack/page/login.js', output: { path: path.resolve(__dirname, './public_html/js/bundle'), publicPath: '/js/bundle/', filename: 'login@0.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 webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false } }), new webpack.LoaderOptionsPlugin({ minimize: true }) ]) }