In webpack what's the difference between path and publicPath
I have a webpack config file shown below that links main.js
to ./src/
in./lib/public
What exactly does publicPath do? I see it only path
indicates the folder that the js package will go in?
module.exports = {
entry: './src/js/main.js',
output: {
filename: 'bundle.js',
path: './lib/public/',
publicPath: 'public'
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader' }
]
}
};
+3
source to share
2 answers
You can use this to locate your assets (images, etc.). That is, you can download assets from a custom directory or CDN even by installing it. See output.publicPath in the official documentation for details .
+3
source to share