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!