https://github.com/cherry/tailwind-fluid-cjs-repro
https://github.com/cherry/tailwind-fluid-cjs-repro
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cherry/tailwind-fluid-cjs-repro
- Owner: Cherry
- Created: 2024-07-20T14:30:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-20T14:39:42.000Z (almost 2 years ago)
- Last Synced: 2025-03-19T07:11:32.477Z (over 1 year ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Issues using Fluid programatically
Issue link: https://github.com/barvian/fluid-tailwind/issues/39
We have a workflow where we use Tailwind to generate a static "theme" output using `resolveConfig`. An example of this can be seen in the `generate-theme.js` file.
- With Fluid disabled, this works without issue
- However, if you uncomment line 1 in `tailwind.config.js` to enable Fluid, the `generate-theme.js` file will throw an error like so:
```
E:\GitHub\tailwind-fluid-cjs-repro\node_modules\fluid-tailwind\dist\index.js:8
var mapObject = require('map-obj');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\GitHub\tailwind-fluid-cjs-repro\node_modules\map-obj\index.js from E:\GitHub\tailwind-fluid-cjs-repro\node_modules\fluid-tailwind\dist\index.js not supported.
Instead change the require of E:\GitHub\tailwind-fluid-cjs-repro\node_modules\map-obj\index.js in E:\GitHub\tailwind-fluid-cjs-repro\node_modules\fluid-tailwind\dist\index.js to a dynamic import() which is available in all CommonJS modules.
at Object. (E:\GitHub\tailwind-fluid-cjs-repro\node_modules\fluid-tailwind\dist\index.js:8:17) {
code: 'ERR_REQUIRE_ESM'
}
```