var Path = require('path'); var LiveReloadPlugin = require('webpack-livereload-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin') var HardSourceWebpackPlugin = require('hard-source-webpack-plugin') var prod = process.env.NODE_ENV === 'production' module.exports = { entry: Path.resolve('src/index.js'), output: { path: Path.resolve('static/src'), filename: 'main.js' }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue$': 'vue/dist/vue.esm.js', '@': Path.resolve('src'), '@@': Path.resolve('src/components') } }, plugins: [ new LiveReloadPlugin({ hostname: "192.168.88.130", port: 8071 }), new ExtractTextPlugin('main.css'), new HardSourceWebpackPlugin({ cacheDirectory: 'node_modules/.cache/hard-source/[confighash]', recordsPath: 'node_modules/.cache/hard-source/[confighash]/records.json', configHash: function(webpackConfig) { return require('node-object-hash')({sort: false}).hash(webpackConfig) }, nvironmentHash: { root: process.cwd(), directories: [], files: ['package-lock.json', 'yarn.lock'], } }) ], module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options :{ extractCSS: prod } }, { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', include: Path.resolve('src') }, { test: /\.css$/, loader: ['style-loader', 'css-loader'] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: Path.posix.join('static', 'img/[name].[hash:7].[ext]') } } ] } }