$ npm ls
├─┬ test-webcomponent-feature-a@0.0.2
│ └── test-webcomponent@1.0.0
└─┬ test-webcomponent-feature-b@0.0.3
└── test-webcomponent@2.0.0
As you can see there are 2 major versions of test-webcomponent
.
- build step via polyserv to translate bare module specifier to relative path
IS:
Page Feature A+B gives error in browser
DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
SHOULD BE: Error during install? => package name map could solve it? => let's try Setup 2
npm install --only=production
npm run start:noShim
- Open http://127.0.0.1:8081/components/build-pnm-webcomponent-issue/
- Feature A, Feature B works
- Feature A+B gives error
- yarn plug'n'play
- generate package-name-maps (via build-pnm)
- shim package-name-maps (via es-module-shims)
IS:
Page Feature A+B gives error in browser
DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
SHOULD BE: Error/Question while creating package name map.
Possible example flow:
Could not find a sadisfying version for 'test-webcomponent'. Which one would you like to use in your package name map?
> v1.0.0 (required by test-webcomponent-feature-a@0.0.2)
v2.0.0 (required by test-webcomponent-feature-b@0.0.3)
yarn install
yarn start
- Open http://127.0.0.1:8080
- Feature A, Feature B works
- Feature A+B gives error