Reputation: 13
How I can change paths to my bundle files from /myBundleFile.js
to /static/myBundleFile.js
in script src in index.html
that I get from building my React project with Nx?
I'm using the default React plugin for Nrwl Nx.
Upvotes: 1
Views: 1874
Reputation: 407
You can achieve that by adding output.fileName
and output.chunkFilename
to the webpack.config.js
of your app, like this:
module.exports = {
output: {
// ...
filename: 'static/[name].[contenthash:20].js',
chunkFilename: 'static/[name].[contenthash:20].chunk.js',
},
// ...
}
Upvotes: 0
Reputation: 9
You need to use the deployUrl
property in the project.json
for that project.
https://nx.dev/packages/web/executors/webpack#deployurl
Upvotes: 0