Skip to content
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

Using injectType linkTag with webpack leads to url being an esModule #428

Closed
4iAmAve opened this issue Nov 28, 2019 · 4 comments · Fixed by #429
Closed

Using injectType linkTag with webpack leads to url being an esModule #428

4iAmAve opened this issue Nov 28, 2019 · 4 comments · Fixed by #429

Comments

@4iAmAve
Copy link

4iAmAve commented Nov 28, 2019

  • Operating System: Windows 10/Ubuntu 19/MacOS latest
  • Node Version: latest
  • NPM Version: latest
  • webpack Version: 4.41
  • style-loader Version: 1.0.0

Expected Behavior

The injected link tag should reference the correct link URL.

Actual Behavior

The passed url parameter into the link tag function is an esModule (for whatever reason) as follows:

{
  "default": "//localhost:4001/main.css"
}

Hence the appended <link /> child looks like this:

<link rel="stylesheet" href="[object Module]">

No matter whether we use import './main.css' or require('./main.css'); in our component code.
Even import styles from './main.css' does not help.

Code

    {
        test: /\.css$/,
        use: [
          {
            loader: 'style-loader',
            options: {
              injectType: 'linkTag'
            }
          },
          {
            loader: 'file-loader',
            options: {
              name: 'main.css',
            },
          },
        ]
      },
@alexander-akait
Copy link
Member

Thanks for issue 👍

@4iAmAve
Copy link
Author

4iAmAve commented Nov 28, 2019

@evilebottnawi
Shall I provide a PR?

@alexander-akait
Copy link
Member

@4iAmAve no need, i already WIP on this 👍

@4iAmAve
Copy link
Author

4iAmAve commented Nov 28, 2019

@evilebottnawi

Thanks a lot. That went fast. :)

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.

2 participants