Can I select which files will be compiled in webpack or vueloader while building?

212 Views Asked by At

When I build my Vue project with npm run build, I would like to choose particular Vue files to be (re)compiled into the dist folder. My idea was by changing the configurations in webpack or the webpack-chain to compile from a specific entry point. An example of my goal would be:

Let's assume I have 2 components; A.vue and B.vue (and ofcourse the default files like index.html etc.) Then I build the project, which gives me a ./dist folder with everything compiled. Then after I make changes to B.vue (and change the config file most likely), I only want B.vue to be recompiled into the ./dist folder. I already use dynamic imports so that A.vue and B.vue are different bundles, so that other files should not have to be changed.

Can I select a specific file to be compiled only? (I am aware that the dist folder gets emptied after building, but that I will try to fix later if this could be possible)

1

There are 1 best solutions below

0
On BEST ANSWER

I think you're looking for watch mode: npm run build --watch