img-2 icon indicating copy to clipboard operation
img-2 copied to clipboard

Why do I report an error? Are there examples?

Open 750973092 opened this issue 7 years ago • 4 comments

xi 1e supy 7 h1vb5n be02guh u8x5nwfl s 33

750973092 avatar Apr 27 '18 03:04 750973092

Try

import 'img-2/dist/img-2';

abraham avatar Apr 27 '18 21:04 abraham

@abraham Your solution works. However, shouldn't the expected behavior be to use either import img-2 as that's the package's name or import Img2 since that's what the documentation shows?

AlexGustafsson avatar May 14 '18 13:05 AlexGustafsson

The package name is img-2 as defined by name in package.json. When you install with npm, this is the name you should use to import. I think import 'Img2' was just wrong.

When you do import 'img-2' the loader will typically look for the file defined by main in package.json. Before #10 this was incorrectly pointing at a file that didn't exist.

As a current workaround use import 'img-2/dist/img-2' to explicitly specify the file to load. Once a new version get's published to npm you can switch to import 'img-2'.

abraham avatar May 14 '18 14:05 abraham

Republished as 0.0.4 with the fix provided by @abraham 👍

RevillWeb avatar May 23 '18 07:05 RevillWeb