Skip to content

Instantly share code, notes, and snippets.

@shellscape
Created November 4, 2016 01:15
Show Gist options
  • Save shellscape/359caf7243e7f53d7ff2d60e41f637c3 to your computer and use it in GitHub Desktop.
Save shellscape/359caf7243e7f53d7ff2d60e41f637c3 to your computer and use it in GitHub Desktop.
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