Skip to content

Instantly share code, notes, and snippets.

@roberto-butti
Created May 29, 2017 19:57
Show Gist options
  • Save roberto-butti/7cd8675b9bfc0197147eb2bbc57f7163 to your computer and use it in GitHub Desktop.
Save roberto-butti/7cd8675b9bfc0197147eb2bbc57f7163 to your computer and use it in GitHub Desktop.
webpack configuration file for Vue Loader
// VUE-LOADER: loading module Vue
const vue = require('vue-loader');
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: {
app: './app.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
filename: '[name].bundle.js',
},
module: {
rules: [{
test: /\.js$/,
include: path.resolve(__dirname, 'src'),
use: [{
loader: 'babel-loader'
}]
}, { // VUE-LOADER: new rule in module section for VUE module
test: /\.vue$/,
include: path.resolve(__dirname, 'src'),
use: [{
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' // <style lang="sass">
}
}
}]
}]
}, // VUE-LOADER: define and alias for vue loader
resolve: {
alias: {
vue: 'vue/dist/vue.js'
}
},
plugins: [
new webpack.NamedModulesPlugin(),
// VUE-LOADER: define NODE_ENV
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment