workaround for es6-promise and vue-server-renderer

This commit is contained in:
Pooya Parsa 2017-08-10 16:16:00 +04:30
parent d7cb08b746
commit 127155d61a
2 changed files with 6 additions and 6 deletions

View File

@ -52,14 +52,15 @@ export default function webpackServerConfig () {
// https://webpack.js.org/configuration/externals/#externals // https://webpack.js.org/configuration/externals/#externals
// https://github.com/liady/webpack-node-externals // https://github.com/liady/webpack-node-externals
const moduleDirs = [ const moduleDirs = [
this.options.modulesDir, this.options.modulesDir
resolve(__dirname, '..', 'node_modules') // Temporary disabled due to vue-server-renderer module search limitations
// resolve(__dirname, '..', 'node_modules')
] ]
moduleDirs.forEach(dir => { moduleDirs.forEach(dir => {
if (existsSync(dir)) { if (existsSync(dir)) {
config.externals.push(nodeExternals({ config.externals.push(nodeExternals({
// load non-javascript files with extensions, presumably via loaders // load non-javascript files with extensions, presumably via loaders
whitelist: [/\.(?!(?:js|json)$).{1,5}$/i], whitelist: [/es6-promise|\.(?!(?:js|json)$).{1,5}$/i],
modulesDir: dir modulesDir: dir
})) }))
} }

View File

@ -132,9 +132,8 @@ export default class Renderer extends Tapable {
// Create bundle renderer for SSR // Create bundle renderer for SSR
this.bundleRenderer = createBundleRenderer(this.resources.serverBundle, Object.assign({ this.bundleRenderer = createBundleRenderer(this.resources.serverBundle, Object.assign({
clientManifest: this.resources.clientManifest, clientManifest: this.resources.clientManifest,
runInNewContext: false runInNewContext: false,
// Explicitly setting basedir makes problems with linked nuxt and npx basedir: this.options.rootDir
// basedir: this.options.rootDir
}, this.options.render.bundleRenderer)) }, this.options.render.bundleRenderer))
// Promisify renderToString // Promisify renderToString