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

ES module support #387

Open
mantismamita opened this issue Jul 22, 2021 · 3 comments
Open

ES module support #387

mantismamita opened this issue Jul 22, 2021 · 3 comments

Comments

@mantismamita
Copy link

@mantismamita mantismamita commented Jul 22, 2021

Hello, our team is migratiing from sapper to sveltekit and I'm struggling a bit with a script with postcss-cli which we use to generate a json file with custom variables to be used in js.

I'm getting the folowing error:
require() of ES modules is not supported. require() of /Xxxx/xxxxxxxxx/xxxxxx/kit/src/assets/styles/postcss.config.js from /Xxxx/xxxxxxxxx/xxxxxx/kit/node_modules/lilconfig/dist/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename postcss.config.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/mantismamita/radiofrancewww/kit/package.json.

The problem is that we don't want to use cjs in the project. Is there a possiblity of using a package that uses ES modules thus avoiding the need to use cjs in our postcss.config?

@RyanZim
Copy link
Collaborator

@RyanZim RyanZim commented Jul 22, 2021

Through a chain of dependencies, we are blocked on davidtheclark/cosmiconfig#224; contributing there would be the first step to offering ESM support. Otherwise, you'll be forced to use the .cjs extension.

@RyanZim
Copy link
Collaborator

@RyanZim RyanZim commented Sep 24, 2021

We're now dependent on https://github.com/antonk52/lilconfig; which is better maintained and should be better able to support this; just need someone to open an issue/PR there.

@RodrigoOkuta
Copy link

@RodrigoOkuta RodrigoOkuta commented Oct 20, 2021

I'm also having the same issue

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

No branches or pull requests

3 participants