Skip to content

Instantly share code, notes, and snippets.

@ThePendulum
Created July 6, 2017 14:06
Show Gist options
  • Save ThePendulum/848292c9223148e4287aa792719e5042 to your computer and use it in GitHub Desktop.
Save ThePendulum/848292c9223148e4287aa792719e5042 to your computer and use it in GitHub Desktop.
'use strict';
const webpack = require('webpack');
const path = require('path');
const ExtractText = require('extract-text-webpack-plugin');
const cssnext = require('postcss-cssnext');
const config = {
entry: './assets/js/main.js',
output: {
filename: './public/js/bundle.js'
},
plugins: [
new ExtractText('./public/css/style.css')
],
devtool: 'eval-source-map',
module: {
rules: [{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader',
options: {
extractCSS: true
}
}, {
test: /\.js$/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015', 'stage-3'],
plugins: ['transform-object-rest-spread']
}
}]
}, {
test: /\.scss$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "sass-loader" // compiles Sass to CSS
}]
}, {
test: /\.svg/,
use: 'raw-loader'
}]
},
resolve: {
alias: {
config: path.join(__dirname, process.env.NODE_ENV ? `assets/js/config.${process.env.NODE_ENV}.js` : 'assets/js/config.js'),
'vue$': 'vue/dist/vue.common.js'
}
}
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment