ESM-style config files don't work #2309
-
I've followed the first lines of advice https://www.snowpack.dev/reference/configuration in hopes of creating a
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
You're right, we don't currently support this. Looks like Node.js needs us to run |
Beta Was this translation helpful? Give feedback.
-
Is this the reason TypeScript config (snowpack.config.ts) doesn’t work in 3.0 either? |
Beta Was this translation helpful? Give feedback.
-
Chiming in to say that this is confusing when trying to adopt Snowpack for a project. The appeal of Snowpack is that I can basically live in an ESM-only world, but... it seems the very first thing I have to do is write a CommonJS file. My project is configured as That's not all too crazy, but it's a really discouraging start, and makes me feel I'm going to have to add regular workarounds for Snowpack instead of things "just working". It would be a lot more welcoming if ESM config files worked by default. |
Beta Was this translation helpful? Give feedback.
-
Chiming in, I had everything in my project using TS+Snowpack and it was great - was really impressed with Snowpack's dev cycle and ease. However, I added my first unit test using ts-node and I was required to change my package.json to type:module and found this bug. Any updates on supporting ESM config files ? |
Beta Was this translation helpful? Give feedback.
You're right, we don't currently support this. Looks like Node.js needs us to run
import()
instead ofrequire()
to load your config as ESM. I'll update the docs to align with what we currently support (only CJS config for now) and then we can look into adding this support back.