Closed its-dibo closed 3 years ago
Colorette should work out of the box on old Node because we define entry points for it here.
ok, so how to solve this issue? I use node v12.14.1
as mentioned in the error trace, your package defined type: module
, here so it treats index.js
as ES module.
If you are importing an ES module in Node v12.*
you also need to specify the --experimental-modules
flag when running your program. Did you try that?
I use webpack which uses ts-node which registers tsconfig-paths which on its turn uses colorette.
I set module: commonjs
to my tsconfig.json and can't require to use ES modules.
I don't run node by myself at all
require
ing Colorette should work out of the box when using CommonJS. This looks like a webpack thing, so closing.
I have an issue when I try to run webpack with
webpack.config.ts
written in typescript andts-node
has"require": ["tsconfig-paths/register"]
// tsconfig.json
when I remove
"require": ["tsconfig-paths/register"]
fromts-node
it runs, but webpack cannot detect aliases.I already set
module: commonjs
in mytsconfig.json
and removedtype: module
from mypackage.json
trace