tinycolor
tinycolor copied to clipboard
webpack can't find import entry
import { inputToRGB } from '@ctrl/tinycolor';
then inputToRGB
is undefined. because it resolved to @ctrl/tinycolor/dist/index.js
but if i change like this it can work.
import { inputToRGB } from '@ctrl/tinycolor/dist/public_api.js';
seem like package.json entry not working here, but others package is fine, only this package has the problem.
my dependency chain is : @ant-design/[email protected] -> @ant-design/[email protected] -> @ctrl/[email protected]
+1
can you try editing the @ctrl/tinycolor package.json in your node_modules to
"main": "./dist/public_api.js",
"module": "./dist/module/public_api.js",
"typings": "./dist/public_api.d.ts",
and see if that fixes it for you
I get the same error:
xy.page.ts:74:21-30 - Error: export 'TinyColor' (imported as 'TinyColor') was not found in '@ctrl/tinycolor' (possible exports: default)
The import is import { TinyColor } from '@ctrl/tinycolor';
. When I replace it with import { TinyColor } from '@ctrl/tinycolor/dist/public_api.js';
it works.
The suggested modification of the package.json in node_modules did not work.
As a workaround, i added a path in the tsconfig.base.json:
{ "compilerOptions": { "paths": { "@ctrl/tinycolor": ["@ctrl/tinycolor/dist/index.js"] } }
Environment: Apple M1 Ventura, NPM 9.6.7
I get the same error with '@ant-design/icons'