I was looking for a way to change the publicPath url in one of my specific files without affecting those other files which are in pipeline.
So let's say i have three files compiled like this using mix
mix .js('resources/js/imageEditor.js', 'public/js') .js('resources/js/app.js', 'public/js/laravel.app.js') .js('resources/js/pines-ui/pines-ui.js', 'public/js/pines-ui.js')
and i only need to change public path to process.env.APP_URL for imageEditor.js but the problem is that it is being updated in the other files as well. For getting process.env.APP_URL in js file i defined webpack plugin
mix.webpackConfig(webpack => { return { plugins: [ new webpack.DefinePlugin({ 'process.env.APP_URL': JSON.stringify(process.env.APP_URL), }), ], } })
and before i do anything else in imageEditor.js, i changed webpack global path there
__webpack_public_path__ = process.env.APP_URL + '/';
and it worked but also changed in laravel.app.js and pines-ui.js as well.
How to control publicPath at individual file level?