I have the simplest backpack config like this:
module.exports = {
webpack: (config, options, webpack) => {
config.entry.main = [
'./app.js'
]
return config;
}
}
But inside my app I have
const myConfig = require('./config/someConfiguration.json');
This file ./config/someConfiguration.json should not be bundled so that it can be modified/configured.
I tried to do it like that:
module.exports = {
webpack: (config, options, webpack) => {
config.entry.main = [
'./app.js'
];
config.externals = [
'./config/someConfiguration.json'
];
return config;
}
}
But then I had 2 issues. One small one was that now I have to include the file like that '../config/someConfiguration.json' since it is required from the ./build/main.js bundled script. The other issue was that MySQL module started to throw exception out of nowhere:
this.handshake = Packets.Handshake.fromPacket(helloPacket);
^
TypeError: Cannot read property 'fromPacket' of undefined...
Which I think means that I am not excluding the file from bundling as it should be. What's the proper way to solve this problem?