Hi been wondering is…

less than 1 minute read

Hi - been wondering - is there a way to use dynamic imports inside an nx workspace? My use case is this - I have lots of config files inside a lib’s folder and I’d like to import all of them in one go (somewhat like this: https://webpack.js.org/api/module-methods/#magic-comments). I tried doing that - but it doesn’t work in my lib. webpack: Module Methods | webpack

Responses:

Libs use Rollup, apps use webpack

You might need to create a custom rollup confit along with a rollup plugin to do it

No sure if rollup supports it out of the box

Wow - didn’t know that! Thanks

I’ve never used rollup - this is an opportunity to learn something new :)

Thinking about it - why is it like that? When I’m building an app, I’m using a custom webpack configuration that is being used for my libraries for adding plugins (like coffescript for my legacy files). If my libraries are publishable - it means that when I build them separately for publishing, they will fail because I do not have the required plugins - is this correct? So building libs standalone is different than building libs inside an app.

Updated: