123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- var Path = require('path');
- var LiveReloadPlugin = require('webpack-livereload-plugin')
- var HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
- var ExtractTextPlugin = require('extract-text-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({
- appendScriptTag: true
- }),
- // 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)
- // },
- // environmentHash: {
- // root: process.cwd(),
- // directories: [],
- // files: ['package-lock.json', 'yarn.lock'],
- // }
- // }),
- new ExtractTextPlugin('main.css')
- ],
- 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]')
- }
- }
- ]
- }
- }
|