-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set properties of undefined (setting 'shadowMode') at setLoaderRulesForShadowMode #531
Comments
Hello @RaphaelSiller, you are still using
could you insert these lines under line 51 at your local? if ('use' in vueLoaderRule) {
vueLoaderRule = vueLoaderRule.use.find(rule => rule.loader === 'vue-loader');
} else if (!vueLoaderRule?.options) {
vueLoaderRule = null;
} This could be the solution, there comes a depth I didn't expect. function setLoaderRulesForShadowMode (rules) {
let vueLoaderRule = rules.find(({ test }) => test.test('.vue'));
if ('use' in vueLoaderRule) {
vueLoaderRule = vueLoaderRule.use.find(rule => rule.loader === 'vue-loader');
} else if (!vueLoaderRule?.options) {
vueLoaderRule = null;
}
if (vueLoaderRule) {
vueLoaderRule.options.shadowMode = true;
} else {
throw new Error('Can\'t find `vue-loader`…');
} |
Hey, yeah, I'm still on I had to edit one small thing in your code. Here's my version: function setLoaderRulesForShadowMode (rules) {
let vueLoaderRule = rules.find(({ test }) => test.test('.vue'));
if ('use' in vueLoaderRule) {
vueLoaderRule = vueLoaderRule.use.find(rule => rule.loader.includes('vue-loader'));
} else if (!vueLoaderRule?.options) {
vueLoaderRule = null;
}
if (vueLoaderRule) {
vueLoaderRule.options.shadowMode = true;
} else {
throw new Error('Can\'t find `vue-loader`…');
} Thank you very much for your help. |
@RaphaelSiller Fix is deployed! |
Describe the bug
When compiling my component, I get the following error:
console.log(vueLoaderRule)
after line 51 gives this:I was able to fix it by changing
vueLoaderRule.options.shadowMode = true;
at line 54 tovueLoaderRule.use.find((temp)=>temp.loader.includes('/node_modules/vue-loader/')).options.shadowMode = true;
Additional context
vueLoaderRule.use[0].options.shadowMode = true;
), but that didn't work, because vue-loader was at index 1 and not 0The text was updated successfully, but these errors were encountered: