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

Does not seem to support loading .css files from node_modules #2

Closed
cubodehelio opened this issue Feb 6, 2017 · 1 comment
Closed

Comments

@cubodehelio
Copy link

I'm trying to load normalize.css from node_modules and it give me the following error

SyntaxError: Unexpected token {
/home/cubodehelio/next.js-css-global-style-test/node_modules/normalize.css/normalize.css:13
html {
     ^
SyntaxError: Unexpected token {
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/cubodehelio/next.js-css-global-style-test/.next/dist/pages/index.js:15:18)
    at Module._compile (module.js:570:32)

Even if I explicitly include node_modules in next.config.js:

{
        test: /\.css$/,
        loader: "babel-loader!raw-loader",
        include: ['node_modules/normalize.css', 'pages']
}

I don't know if is a matter of this example or an issue with babel-plugin-wrap-in-js.

I will move third party styles to the pages/ folder in the mean time. Thanks for your work!

@davibe
Copy link
Owner

davibe commented Feb 6, 2017

I just tried. You have to refer to it explicitly, i.e.

import normalize from '../node_modules/normalize.css/normalize.css'

I understand this is not ideal but it's still reasonable comprated to not having this at all :)

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

2 participants