0

I'm using mxstbr/react-boilerplate that uses the great DllPlugin, but as the application is served by nginx under /admin, it fails with an 404 when trying to get the reactBoilerplateDeps.dll.js file from the root url (it hits http://localhost/reactBoilerplateDeps.dll.js instead of http://localhost/admin/reactBoilerplateDeps.dll.js).

Is there any similar concept to Webpack's publicPath option on DllPlugin or any way of telling DllPlugin that is being used under a path prefix?

2 Answers2

0

I did it adding the prefix where the dll scripts are appended to the body:

dllNames.forEach((dllName) => body.append(`<script data-dll='true' src='/${dllName}.dll.js'></script>`)); to dllNames.forEach((dllName) => body.append(`<script data-dll='true' src='/${somePrefix}${dllName}.dll.js'></script>`));

Also, depending on how are you proxying the requests, you should ensure the dev server handles the filename correctly. So if you are also passing the prefix to the dev server, you should remove it from the request path here.

0

For webpack.dev.babel.js format, click here

I was struggling with the same but tried the following :

1) Go to you webpack.dev.babel.js

2) Go to the line where you've added this :

dllNames.forEach((dllName) => body.append(<script data-dll='true' src='/${dllName}.dll.js'></script>));

3) Remove 'backslash'(/) as node_modules files once installed are publicly available. So, after removing, it will be :

dllNames.forEach((dllName) => body.append(<script data-dll='true' src='${dllName}.dll.js'></script>));

4) run npm run build:dll

5) npm start

I hope, it helps.