Skip to content

Import third party CSS in JS file #1107

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
dirkjf opened this issue Mar 27, 2022 · 1 comment
Closed

Import third party CSS in JS file #1107

dirkjf opened this issue Mar 27, 2022 · 1 comment

Comments

@dirkjf
Copy link

dirkjf commented Mar 27, 2022

In a new Symfony project that was created using symfony new my_project_directory --webapp, importing local CSS in a JS file like such works:

// app.js

import './github.css';

However when I try to add CSS from a third part, for example highlightJS, I get some strange behaviour:

// app.js

import 'highlight.js/styles/github.css'; // successful build, but won't work

It will only work when using import(), like so:
import('highlight.js/styles/github.css');

I would expect import to work for files in node_modules as it does for my own files and not have to use import(). Or am I missing something?

@dirkjf
Copy link
Author

dirkjf commented Mar 28, 2022

Closing this as it is not an issue with Webpack Encore, but with highlight.js.

@dirkjf dirkjf closed this as completed Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant