Skip to content

Instantly share code, notes, and snippets.

@beiyuu
Last active July 19, 2016 10:31
Show Gist options
  • Save beiyuu/9fd4171ee17f1f79b88c75d1fd81408f to your computer and use it in GitHub Desktop.
Save beiyuu/9fd4171ee17f1f79b88c75d1fd81408f to your computer and use it in GitHub Desktop.
//"babel-loader": "6.2.4"
//"babel-plugin-transform-runtime": "6.7.5"
//"babel-preset-es2015": "6.6.0"
var path = require('path')
var glob = require('globby')
var webpack = require('webpack')
var JS_PATH = path.join(__dirname, './fe/js')
function getEntries() {
var map = {}
var fileList = glob.sync(['./fe/js/**/*.js',
'!./fe/js/**/_*.js',
'!./fe/js/lib/**/*.js',
'!./fe/js/utils/**/*.js',
'!./fe/js/mods/**/*.js'])
fileList.forEach(function (file) {
var name = path.basename(file)
var filePath = path.relative(JS_PATH, file)
if (name.match(/^[^_](.+)\.js$/)) {
map[filePath] = file
}
})
return map
}
module.exports = {
context: __dirname,
entry: getEntries(),
output: {
path: path.join(__dirname, 'build/webpack'),
filename: '[name]'
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015'],
plugins: ['transform-runtime'],
cacheDirectory: './build/tmp'
}
}, {
test: /\.vue$/,
loader: 'vue'
}]
},
resolve: {
root: JS_PATH,
alias: { }
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
],
devtool: '#inline-source-map',
externals: {
'jquery': '$',
'vue': 'Vue'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment