Skip to content

Getting warnings for export 'default' (imported as 'mod') was not found #1742

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

Closed
amir20 opened this issue Oct 17, 2020 · 14 comments · Fixed by #1748
Closed

Getting warnings for export 'default' (imported as 'mod') was not found #1742

amir20 opened this issue Oct 17, 2020 · 14 comments · Fixed by #1748

Comments

@amir20
Copy link

amir20 commented Oct 17, 2020

Version

15.9.3

Reproduction link

https://github.com/amir20/dozzle/tree/webpack5

Steps to reproduce

git clone https://github.com/amir20/dozzle/tree/webpack5
yarn
yarn build

What is expected?

No warnings

What is actually happening?

I am getting a lot of warnings that look like

WARNING in ./assets/components/SideMenu.vue?vue&type=style&index=0&id=59920051&scoped=true&lang=scss& 1:495-498
export 'default' (imported as 'mod') was not found in '-!../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-1[0].rules[0].use[0]!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??clonedRuleSet-1[0].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SideMenu.vue?vue&type=style&index=0&id=59920051&scoped=true&lang=scss&' (possible exports: )
 @ ./assets/components/SideMenu.vue 4:0-93
 @ ./node_modules/vue-loader/lib/index.js??vue-loader-options!./assets/App.vue?vue&type=script&lang=js& 46:0-45 55:4-12
 @ ./assets/App.vue?vue&type=script&lang=js& 1:0-115 1:131-134 1:136-248 1:136-248
 @ ./assets/App.vue 2:0-55 3:0-50 3:0-50 10:2-8
 @ ./assets/main.js 8:0-28 59:19-22

WARNING in ./assets/pages/Index.vue?vue&type=style&index=0&id=ee5d2aae&lang=scss&scoped=true& 1:492-495
export 'default' (imported as 'mod') was not found in '-!../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-1[0].rules[0].use[0]!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??clonedRuleSet-1[0].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Index.vue?vue&type=style&index=0&id=ee5d2aae&lang=scss&scoped=true&' (possible exports: )
 @ ./assets/pages/Index.vue 4:0-90
 @ ./assets/pages/index.js 1:0-47 1:0-47
 @ ./assets/main.js 9:0-92 19:15-20 24:15-24 30:15-32 35:15-23 40:15-19 45:15-27

WARNING in ./assets/pages/Settings.vue?vue&type=style&index=0&id=8dc7fec8&lang=scss&scoped=true& 1:495-498
export 'default' (imported as 'mod') was not found in '-!../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-1[0].rules[0].use[0]!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??clonedRuleSet-1[0].rules[0].use[2]!../../node_modules/sass-loader/dist/cjs.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Settings.vue?vue&type=style&index=0&id=8dc7fec8&lang=scss&scoped=true&' (possible exports: )
 @ ./assets/pages/Settings.vue 4:0-93
 @ ./assets/pages/index.js 5:0-53 5:0-53
 @ ./assets/main.js 9:0-92 19:15-20 24:15-24 30:15-32 35:15-23 40:15-19 45:15-27

I created this issue at webpack-contrib/mini-css-extract-plugin#625 but suggestion was to do it here instead

@lllopo
Copy link

lllopo commented Oct 19, 2020

Yup. I can confirm. Having similar problem, reported it here : webpack-contrib/mini-css-extract-plugin#622 and got also redirected to vue-loader by the mini-css-extract developer.

@dboonstra177
Copy link

I have the same issue which I somewhat fixed, I think it is a combined issue between css-loader and mini-css-extract-plugin.

My Fix: I moved all of my css to an actual css file instead of declaring it locally or scoped. This removed every warning/error I had which was 150+ errors after the package upgrade.

I am still having an issue though I am trying to use vue-multiselect which requires css initialization which doesn't work from the css file so I haven't figured out how to resolve that so hopefully someone posts more information about that.

@amir20
Copy link
Author

amir20 commented Oct 19, 2020

My Fix: I moved all of my css to an actual css file instead of declaring it locally or scoped. This removed every warning/error I had which was 150+ errors after the package upgrade.

That's not a fix. That's a workaround. :)

@lllopo
Copy link

lllopo commented Oct 19, 2020

For me it works more or less fine without warnings with mini-css-extract 0.12.0, but this is again a temporary workaround and also not the best one. Hope this will get fixed soon.

@cjingle
Copy link

cjingle commented Oct 22, 2020

I'm having the same issue. Please let us know when you have a resolution.

@dineug
Copy link

dineug commented Oct 23, 2020

I have the same problem.
I looked it up.
There was an esModule in mini-css-extract-plugin v1.0.0
I solved it with this.

{
  loader: MiniCssExtractPlugin.loader,
  options: {
    esModule: false,
  },
}

@ribatugo
Copy link

Setting 'esModule: false' does not change anything on my side...

@thecrypticace
Copy link
Contributor

I've done a bit of digging around this. Not 100% sure what the issue is but hopefully this'll help.

This is the line it's complaining about

return `import mod from ${request}; export default mod; export * from ${request}`

Webpack sees the following as the source of the module:

// extracted by mini-css-extract-plugin
export {};

So mini-css-extract-plugin is extracting the styles and replacing it with an empty export causing it to complain b/c of the import vue-loader is using.

@lllopo
Copy link

lllopo commented Oct 24, 2020

Still there with rc1 for me. esModule:false helps, though.

@emgyrz
Copy link

emgyrz commented Nov 25, 2020

In my case, the replacement of imports helped

//  from
import * as ST from './styles.scss

// to
import ST from './styles.scss

and without

options: {
  esModule: false,
},

@Zertz
Copy link

Zertz commented Jan 5, 2021

For me, this error unclearly but rightfully happened when I used a default export on a CSS Module that only had :global selectors and I was mistakenly using styles.something (which didn't exist)

Example:

Component.module.css

:global .legacy-global-selector {
    outine: 1px solid tomato;
}

Component.jsx

import styles from "./Component.module.css";

export function Component() {
  return (
    <span className={styles.span}>This selector doesn't exist!</span>
  );
}

To fix it, I changed Component.jsx to:

import "./Component.module.css";

export function Component() {
  return (
    <span>This selector doesn't exist!</span>
  );
}

@ETSVSCode
Copy link

ETSVSCode commented Jun 29, 2021

I was getting this error with below class syntax:

export class User { }

Solved By this syntax:

class User {}
export default User;

@DmytroVoitovych
Copy link

just remove the loader, it is not needed when working with the plugin **"// 'style-loader', // it conflicts with the plugin"**

@KDDeveloper
Copy link

KDDeveloper commented Nov 7, 2022

just remove the loader, it is not needed when working with the plugin **"// 'style-loader', // it conflicts with the plugin"**

This worked! Thankyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.