Common js require import
rajasegar opened this issue · 3 comments
rajasegar commented
I installed the parsel-js
npm package
Trying to import
const parsel = require('parsel-js')
It throws error like this:
Details:
/home/boot/Public/www/ember-tailwind-codemod/node_modules/.pnpm/parsel-js@1.0.1/node_modules/parsel-js/parsel.js:21
export function gobbleParens(text, i) {
^^^^^^
SyntaxError: Unexpected token 'export'
4 |
5 | const postcss = require('postcss');
> 6 | const parsel = require('parsel-js');
| ^
7 | console.log(parsel);
8 |
9 | const identity = (value) => value;
at Runtime.createScriptFromCode (node_modules/.pnpm/jest-runtime@26.6.3/node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (transforms/tailwind/index.js:6:16)
LeaVerou commented
Is ESM import an option? Node does support it.
LeaVerou commented
Otherwise, I'd welcome a PR to add Rollup so we could have a CJS build, but I absolutely don't have the bandwidth to do it myself right now, sorry. 🤷🏽♀️