Webpack - dynamic require and paths

后端 未结 1 367
野性不改
野性不改 2021-01-15 16:42

My webpack.config file looks like this

var path = require(\'path\');
var webpack = require(\'webpack\');

module.exports = {
    entry: {
        app: \'./ap         


        
相关标签:
1条回答
  • 2021-01-15 17:19

    You probably need to set the public path- basically, you tell webpack where on your webserver it will find the built files, which for you seems to the the build folder.

    {
        output: {
            path: path.resolve(__dirname, 'build'),
            filename: '[name]-bundle.js',
            publicPath: '/build/',
        },
    }
    
    0 讨论(0)
提交回复
热议问题