3

I have a mono-repository containing a library application bundled using Webpack & a demo application to test the library.

When I try to import the library in the demo like this:

import Library from 'library-xxxx'

I get the following error:

Module not found: Can't resolve 'library-xxxx' in 'C:\repository-widget\demo\src'

When I try to import directly the library like this:

import Library from '../dist/library-xxxx'

I get the following error:

Module not found: You attempted to import ../dist/ which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

Is there a solution to import the bundled library from the dist folder into the demo? Here's my repository structure:

root
--dist
----main.js
----package.json
--demo
----app.js ------> where I import the library from the dist 
Melchia
  • 22,578
  • 22
  • 103
  • 117

0 Answers0