Last active
September 14, 2016 15:13
-
-
Save blocka/35292a17429b5ed1565ee8f0a93de780 to your computer and use it in GitHub Desktop.
This file contains 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
Show hidden characters
{ | |
"presets": ["es2015", "stage-2"], | |
"plugins": ["transform-runtime", "es6-promise", "transform-vue-jsx", "transform-flow-strip-types"], | |
"comments": false | |
} |
This file contains 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
var path = require('path'); | |
var config = require('../config'); | |
var cssLoaders = require('./css-loaders'); | |
var projectRoot = path.resolve(__dirname, '../'); | |
var webpack = require('webpack'); | |
module.exports = { | |
node: { | |
fs: "empty" | |
}, | |
entry: { | |
app: './src/main.js' | |
}, | |
output: { | |
path: config.build.assetsRoot, | |
publicPath: config.build.assetsPublicPath, | |
filename: '[name].js' | |
}, | |
resolve: { | |
extensions: ['', '.js', '.vue'], | |
fallback: [path.join(__dirname, '../node_modules')], | |
modulesDirectories: ['../src'], | |
alias: { | |
'src': path.resolve(__dirname, '../src'), | |
'assets': path.resolve(__dirname, '../src/assets'), | |
'components': path.resolve(__dirname, '../src/components') | |
} | |
}, | |
resolveLoader: { | |
fallback: [path.join(__dirname, '../node_modules')] | |
}, | |
plugins:[ | |
new webpack.DefinePlugin({ | |
'process.env':{ | |
'NODE_ENV': JSON.stringify(process.env.NODE_ENV) | |
} | |
}) | |
], | |
module: { | |
preLoaders: [ | |
{ | |
test: /\.vue$/, | |
loader: 'eslint', | |
include: projectRoot, | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'eslint', | |
include: projectRoot, | |
exclude: /node_modules/ | |
} | |
], | |
loaders: [ | |
{ | |
test: /\.vue$/, | |
loader: 'vue' | |
}, | |
{ | |
test: /\.css$/, | |
loader: "style-loader!css-loader" | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'babel', | |
include: projectRoot, | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.json$/, | |
loader: 'json' | |
}, | |
{ | |
test: /\.html$/, | |
loader: 'vue-html' | |
}, | |
{ | |
test: /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf)(\?.*)?$/, | |
loader: 'url', | |
query: { | |
limit: 10000, | |
name: path.join(config.build.assetsSubDirectory, '[name].[hash:7].[ext]') | |
} | |
} | |
] | |
}, | |
vue: { | |
loaders: cssLoaders() | |
}, | |
eslint: { | |
formatter: require('eslint-friendly-formatter') | |
} | |
}; |
This file contains 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
var webpack = require('webpack'); | |
var merge = require('webpack-merge'); | |
var baseWebpackConfig = require('./webpack.base.conf'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
// add hot-reload related code to entry chunks | |
Object.keys(baseWebpackConfig.entry).forEach(function (name) { | |
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]); | |
}); | |
module.exports = merge(baseWebpackConfig, { | |
// eval-source-map is faster for development | |
devtool: '#eval-source-map', | |
plugins: [ | |
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin(), | |
// https://github.com/ampedandwired/html-webpack-plugin | |
new HtmlWebpackPlugin({ | |
filename: 'index.html', | |
template: 'index.html', | |
inject: true | |
}) | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment