Open horprogs opened 5 years ago
Describe the bug Button component has window, and I get error ReferenceError: window is not defined on server-side.
window
ReferenceError: window is not defined
Expected behavior Component mustn't throw error in server-side.
Screenshots
The tenth line contains window in file node_modules/material-components-vue/dist/button/index.js.
node_modules/material-components-vue/dist/button/index.js
I guess it happens, because target is web in webpack config. I found similar discussion about it https://github.com/webpack/webpack/issues/6522. Also, I found your issue, where you set taget: node, but now I can't find this config (https://github.com/matsp/material-components-vue/commit/cfd107090bb657895f98d37a76f4eb31b6a7a50b).
taget: node
@horprogs Thanks for the hint. We must provide a module that is usable on server side. Maybe I switch to Rollup because it's better for bundling up libraries.
Describe the bug Button component has
window
, and I get errorReferenceError: window is not defined
on server-side.Expected behavior Component mustn't throw error in server-side.
Screenshots
The tenth line contains
window
in filenode_modules/material-components-vue/dist/button/index.js
.I guess it happens, because target is web in webpack config. I found similar discussion about it https://github.com/webpack/webpack/issues/6522. Also, I found your issue, where you set
taget: node
, but now I can't find this config (https://github.com/matsp/material-components-vue/commit/cfd107090bb657895f98d37a76f4eb31b6a7a50b).