Add server-side rendering (via bundleRenderer, as this is what the Vue docs recommend, and apparently the only way it does encapsulation)

This commit is contained in:
Steve Sanderson
2017-03-10 10:51:47 +00:00
parent 360688f78b
commit 119b274c19
14 changed files with 117 additions and 51 deletions

View File

@@ -5,17 +5,10 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
const extractCSS = new ExtractTextPlugin('vendor.css');
return [{
stats: { modules: false },
resolve: {
extensions: [ '.js' ]
},
module: {
rules: [
{ test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' },
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) }
]
},
resolve: { extensions: [ '.js' ] },
entry: {
vendor: [
'bootstrap',
@@ -27,15 +20,24 @@ module.exports = (env) => {
'vue-router'
],
},
output: {
module: {
rules: [
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) },
{ test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }
]
},
output: {
path: path.join(__dirname, 'wwwroot', 'dist'),
publicPath: '/dist/',
filename: '[name].js',
library: '[name]_[hash]',
library: '[name]_[hash]'
},
plugins: [
extractCSS,
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.DefinePlugin({
'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"'
}),
new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'