mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Remove Vue template server-side prerendering because of limitations
This commit is contained in:
@@ -2,22 +2,17 @@ const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
|
||||
const VueSSRPlugin = require('vue-ssr-webpack-plugin');
|
||||
const merge = require('webpack-merge');
|
||||
const bundleOutputDir = './wwwroot/dist';
|
||||
|
||||
module.exports = (env) => {
|
||||
const isDevBuild = !(env && env.prod);
|
||||
|
||||
// Configuration in common to both client-side and server-side bundles
|
||||
const sharedConfig = {
|
||||
const bundleOutputDir = './wwwroot/dist';
|
||||
return [{
|
||||
stats: { modules: false },
|
||||
context: __dirname,
|
||||
resolve: { extensions: [ '.js', '.ts' ] },
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
publicPath: '/dist/'
|
||||
},
|
||||
entry: { 'main': './ClientApp/boot.ts' },
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.vue\.html$/, include: /ClientApp/, loader: 'vue-loader', options: { loaders: { js: 'awesome-typescript-loader?silent=true' } } },
|
||||
@@ -26,22 +21,18 @@ module.exports = (env) => {
|
||||
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
|
||||
]
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, bundleOutputDir),
|
||||
filename: '[name].js',
|
||||
publicPath: '/dist/'
|
||||
},
|
||||
plugins: [
|
||||
new CheckerPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(isDevBuild ? 'development' : 'production')
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
// Configuration for client-side bundle suitable for running in browsers
|
||||
const clientBundleOutputDir = './wwwroot/dist';
|
||||
const clientBundleConfig = merge(sharedConfig, {
|
||||
entry: { 'main-client': './ClientApp/boot-client.ts' },
|
||||
output: { path: path.join(__dirname, clientBundleOutputDir) },
|
||||
plugins: [
|
||||
}),
|
||||
new webpack.DllReferencePlugin({
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
@@ -50,34 +41,11 @@ module.exports = (env) => {
|
||||
// Plugins that apply in development builds only
|
||||
new webpack.SourceMapDevToolPlugin({
|
||||
filename: '[file].map', // Remove this line if you prefer inline source maps
|
||||
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
|
||||
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
|
||||
})
|
||||
] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.UglifyJsPlugin()
|
||||
])
|
||||
});
|
||||
|
||||
// Configuration for server-side (prerendering) bundle suitable for running in Node
|
||||
const serverBundlesOutput = {
|
||||
libraryTarget: 'commonjs2',
|
||||
path: path.join(__dirname, './ClientApp/dist')
|
||||
};
|
||||
const serverBundleConfig = merge(sharedConfig, {
|
||||
resolve: { mainFields: ['main'] },
|
||||
entry: { 'main': './ClientApp/boot-server-bundle.ts' },
|
||||
externals: {},
|
||||
plugins: [new VueSSRPlugin()],
|
||||
output: serverBundlesOutput,
|
||||
target: 'node',
|
||||
devtool: 'inline-source-map'
|
||||
});
|
||||
|
||||
const vueBundleRendererConfig = merge(sharedConfig, {
|
||||
entry: { 'main-server': './ClientApp/boot-server.ts' },
|
||||
output: serverBundlesOutput,
|
||||
target: 'node'
|
||||
});
|
||||
|
||||
return [clientBundleConfig, serverBundleConfig, vueBundleRendererConfig];
|
||||
}];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user