Comments (7)
Sorry, I can’t help with debugging Node.js. This is a question for Stack Overflow or Node.js community.
from postcss.
The question is: does postcss load it's plugins through regular import
or some other nonstandard module loader? If the later, it is very much related to postcss. Have you even looked at the repro?
from postcss.
Mostly default require()
, but there are a hack for TS https://github.com/postcss/postcss-load-config/blob/main/src/req.js
from postcss.
This here confirms that node
can load both variants fine, but postcss cannot:
$ echo '{"type": "module", "exports": {".": "./index.js"}}' > config/package.json && node -e 'import("config").then(console.log)'
[Module: null prototype] { config: {} }
$ echo '{"type": "module", "exports": {".": {"import": "./index.js"}}}' > config/package.json && node -e 'import("config").then(console.log)'
[Module: null prototype] { config: {} }
from postcss.
I think the root problem is that you are using createRequire
which will give you the legacy CJS loader instead of the ESM loader, and the CJS loader will not use the import
entry point but the require
one which does not. So in essense, postcss plugins can not be pure ESM.
from postcss.
Got it, what eactly you asked.
Yes, we do not suppor ESM plugins yet. You may try to create a PR to postcss-load-config
if you have a good plan.
But I don’t think that it will be easy (this is why don’t have it).
from postcss.
Actually the bug is in the tailwindcss
plugin because even after importing the plugin directly in the postcss config, the error persists. The error stack trace has no postcss
in it, so I'm certain this is not a postcss bug.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/config/package.json
at new NodeError (node:internal/errors:405:5)
at exportsNotFound (node:internal/modules/esm/resolve:261:10)
at packageExportsResolve (node:internal/modules/esm/resolve:535:13)
at resolveExports (node:internal/modules/cjs/loader:547:36)
at Module._findPath (node:internal/modules/cjs/loader:621:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
at Function.resolve (node:internal/modules/helpers:136:19)
at _resolve (node_modules/jiti/dist/jiti.js:1:250334)
at jiti (node_modules/jiti/dist/jiti.js:1:252917)
at tailwind.config.js:1:329 {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
from postcss.
Related Issues (20)
- warning while building my Next js application due to which not able to deploy on Vercel. HOT 1
- Get `Unexpected token 'export'` even the project type is already set to `module` HOT 1
- Getting vulnerability in Postcss. HOT 1
- A research for generating PR checklists in Pull Request Template HOT 1
- question/feature request(lint): “not modify” mode for linters HOT 1
- Vulnerability in Postcss despite update HOT 2
- "Unexpected }" error when using comments in interpolation strings HOT 3
- Why does `NoWorkResult` exist? HOT 6
- Is it correct that a `NoWorkResult` is returned when a sourcemap is requested? HOT 4
- Unkown word Error HOT 5
- Unclosed bracket error in url HOT 5
- [vite:css] [postcss] original.line and original.column are not numbers HOT 70
- PostCSS Line Return Parsing Error In Postcss HOT 1
- AtRule#nodes can be undefined HOT 2
- Typings change in `3.4.34` breaks our dev flow for almost all our plugins HOT 7
- [plugin:vite:css] [postcss] Cannot read properties of undefined (reading 'join') HOT 1
- PostCSS issues and Next.js HOT 5
- Unable to obtain Px in LengthUnit HOT 1
- SyntaxError: Invalid or unexpected token HOT 1
- the plugin is activated, but does not work (tailwindcss) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcss.