Open melliott03 opened 5 years ago
If you use Nuxt.js you can check for the variable process.browser
before trying to show notifications:
// ...
if (process.browser) {
this.$notification.show('Hello World', {
body: 'This is an example!'
}, {})
}
// ...
Build for SSR fails with the following message:
Are you using any other plugins or just this one? @rianmartins
Are you using any other plugins or just this one? @rianmartins
I tried to create a new project from scratch using SSR (just by following the tutorial at https://vuejsdevelopers.com/2017/12/11/vue-ssr-router/) and installed only this plugin and it already gave me this error:
Try setting modules
to true
in the .babelrc
file like this:
{
"presets": [
["env", { "modules": true }],
"stage-3"
]
}
Try setting
modules
totrue
in the.babelrc
file like this:{ "presets": [ ["env", { "modules": true }], "stage-3" ] }
I tried a bunch of different configs, I can't even list all of my attempts. But what you suggests throws an error:
Module build failed: Invariant Violation: Invalid Option: The 'modules' option must be either 'false' to indicate no modules, or a
module type which can be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'
All of the options for env modules in .babelrc (false. 'commonjs', 'amd', 'umd' and 'systemjs') gives the same error after the build (while starting the server):
> vue-ssr@1.0.0 start-server absolute\path\to\project\vue-ssr
> node server.js
absolute\path\to\project\vue-ssr\node_modules\vue-native-notification\index.js:124
export default VueNativeNotification
^^^^^^
SyntaxError: Unexpected token 'export'
How would you import this for Server Side Rendering?