Closed morgan-tr closed 4 years ago
I was able to resolve the issue by adding the following rule to webpack.base.conf.js
:
module: {
rules: [
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
}
]
}
...
],
}
I'm importing an SCSS file with shared styles in some of my Vue components:
Running the dev server works fine with the above lines, but the production build fails with the following error:
Module build failed: ReferenceError: document is not defined
I tried commenting out the following lines in
build/utils.js
:This led to a different error:
The only change I've made to the original build file is adding
@babel/polyfill
in the Webpackentry
configuration:However, I read on Babel's website that
@babel/polyfill
has been deprecated, so I changed it to:Any idea how to fix the production build?