tinycolor icon indicating copy to clipboard operation
tinycolor copied to clipboard

webpack can't find import entry

Open Alex-xd opened this issue 3 years ago • 4 comments

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]

Alex-xd avatar Oct 25 '21 06:10 Alex-xd

+1

littleLane avatar Apr 09 '22 14:04 littleLane

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

scttcper avatar Apr 09 '22 19:04 scttcper

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

AdrianM avatar May 30 '23 15:05 AdrianM

I get the same error with '@ant-design/icons'

lkiarest avatar Apr 18 '24 02:04 lkiarest