0

I participate in the development of a JS web app - a Grafana plugin which is packed for production using Webpack.

Currently all the scripts within the src folder are joined in a single file module.js and saved in another folder called dist.

Is it possible that I instruct Webpack to exclude a single file - config.js from that bundle, but keeping the file part of the app - be able to import config from './config'. I know how to copy that file along some other resources to the dist folder using the CopyWebpackPlugin plugin.

Because it is a plugin - part of a bigger application, there is no way that we include additional <script> tags in the HTML (at least not the proper way in the <head> or the end of the <body> of the HTML).

The idea is that we can easily change the content in the config file without having to pack it all over again and again.

I don't mind if the file I use for configuration is in .ts, .js, or .json format

I found a similar question here but it is for Angular and with no definite solution unfortunately.

Thanks to all the readers!

ford04
  • 66,267
  • 20
  • 199
  • 171
vivanov
  • 1,422
  • 3
  • 21
  • 29
  • What do you mean by "keeping the file part of the app". Which type of app are you developing (node, web)? When you want to bundle a web app and still keep the config file separate from the rest of the bundle, then you would have to include it in a script tag in the html. Or you would have to bundle again, if you `require` it. Not sure, if I have understood your idea fully, some more infos would be helpful. – ford04 Aug 27 '19 at 15:23
  • @ford04 - I precised the question as you requested. If you need more info I will be happy to provide. Thanks for the assistance! – vivanov Aug 28 '19 at 07:08

0 Answers0