Nuxt/webpack.config.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-12-09 17:54:17 +00:00
var nodeExternals = require('webpack-node-externals')
2017-02-08 13:09:59 +00:00
var ProgressBarPlugin = require('progress-bar-webpack-plugin')
2016-12-09 17:54:17 +00:00
var CopyWebpackPlugin = require('copy-webpack-plugin')
var resolve = require('path').resolve
var r = function (p) { return resolve(__dirname, p) }
module.exports = {
target: 'node',
node: {
__dirname: false,
__filename: false
},
devtool: 'source-map',
2016-12-27 13:55:33 +00:00
entry: r('./lib/nuxt.js'),
2016-12-09 17:54:17 +00:00
output: {
path: r('./dist'),
filename: 'nuxt.js',
libraryTarget: 'commonjs2'
},
externals: [
2016-12-27 13:55:33 +00:00
nodeExternals()
2016-12-09 17:54:17 +00:00
],
module: {
rules: [
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
2016-12-27 13:55:33 +00:00
plugins: [
'transform-async-to-generator',
'array-includes',
'transform-runtime'
],
2016-12-09 17:54:17 +00:00
presets: [
['es2015', { modules: false }],
'stage-2'
],
cacheDirectory: true
}
}
]
},
plugins: [
new CopyWebpackPlugin([
{ from: 'lib/app', to: 'app' },
{ from: 'lib/views', to: 'views' }
2017-02-08 13:09:59 +00:00
]),
new ProgressBarPlugin()
2017-02-21 09:12:32 +00:00
],
node: {
fs: `empty`,
tls: `empty`,
dns: 'mock',
net: 'mock'
}
2016-12-09 17:54:17 +00:00
}