Created
November 4, 2016 01:15
-
-
Save shellscape/359caf7243e7f53d7ff2d60e41f637c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'), | |
webpack = require('webpack'), | |
ExtractTextPlugin = require('extract-text-webpack-plugin'), | |
CopyWebpackPlugin = require('copy-webpack-plugin'); | |
module.exports = { | |
output: { | |
path: path.join(__dirname, 'dist'), | |
publicPath: '/', | |
filename: '/assets/js/build.js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.vue$/, | |
loader: 'vue', | |
options: { | |
loaders: { | |
css: ExtractTextPlugin.extract({ | |
loader: 'css-loader', | |
fallbackLoader: 'vue-style-loader' | |
}) | |
} | |
} | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'babel', | |
exclude: /node_modules/, | |
query: { | |
'presets': ['es2015', 'stage-0'] | |
}, | |
include: './src' | |
}, | |
{ | |
test: /\.(png|jpg|gif|svg)$/, | |
loader: 'file', | |
options: { | |
name: 'assets/images/[name].[ext]?[hash]' | |
} | |
} | |
] | |
}, | |
resolve: { | |
alias: { | |
'vue$': 'vue/dist/vue' | |
}, | |
extensions: ['.js', '.vue'] | |
}, | |
entry: { | |
'index': [ | |
'eventsource-polyfill', | |
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000', | |
'./src/main.js'] | |
}, | |
plugins: [ | |
new ExtractTextPlugin('/assets/css/style.css'), | |
new webpack.optimize.OccurrenceOrderPlugin(), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin(), | |
new CopyWebpackPlugin( | |
[{ from: 'src/index.html' }], | |
{ copyUnmodified: true } | |
) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment