jhthorsen / mojolicious-plugin-webpack

Integrate your mojo app with webpack
13 stars 7 forks source link

allow rebuilding from webpack script #3

Closed mario-minati closed 4 years ago

mario-minati commented 4 years ago

Hello @jhthorsen,

I missed an option to easy install additional npm modules during development by setting the MOJO_WEBPACK_REINSTALL from webpack.

Greets,

Mario Minati

jhthorsen commented 4 years ago

I don't want to take this PR, since I would rather have a better fix to make sure the dependencies have been built, but not every time I start the application in dev mode. I was considering something like this:

Install deps when node_modules/ is missing, but prevent npm (or pnpm) from running if the package.json file has not been change. The problem here is that I'm not sure what to compare package.json with. I'm considering package-lock.json and pnpm-lock.yaml, but I'm not sure if that's the best idea.

I would very much like a PR that implements something like what I just suggested. The MOJO_WEBPACK_REINSTALL hack is just a temporarily fix.

mario-minati commented 4 years ago

Is this the right place to discuss or shall we create an issue?

Currently I'm adding required npm modules to M:P:Webpack config settings by overriding dependencies config value. This can be detected if we check that every element in dependencies is already part of package.json.

Shall there be a way to add npm modules through webpack author command? This way we could keep control of required modules, but we would create duplicated information according to package.json.