New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why plugin copies specified files into output directory? #82
Comments
Files added to the plugin are output next to other files output by webpack. The whole point is to add files not artefacts of the current build into the context, so you can reference them from within the context. What exactly are you trying to achieve, and could you put up a small sample with your config? Maybe we can make it work for your use case, the way you expect it to work 🙂 |
@SimenB I have the same question. Here is my files structure. the
Here is my config
|
@lonsdale8734 have you find the solution? |
Hi @SimenB , i have the save question, for me, it copies vendor.dll.js to the Webpack config:
And what injected in index.html: Extected injection : any suggestion? |
I was able to get this working by setting both publicPath and outputPath like this new AddAssetHtmlPlugin({
filepath: path.resolve('./dist/js/*.dll.js'),
includeSourcemap: false,
publicPath: '/dist/js',
outputPath: 'dist/js'
}) Result: no extra copies of *.dll.js files, that generated html is good too <script src="/dist/js/vendor.936b5f21868b9612c3d7.dll.js"></script> Might be possible to do this automatically by making tweaks to this...not sure what those tweaks would need to be though. add-asset-html-webpack-plugin/src/addAllAssetsToCompilation.js Lines 79 to 85 in b80adf2
|
hi, I‘m support your idea, but I suggest that you should setting both publicPath and outputPath like this, otherwise it generates a duplicate dist folder new AddAssetHtmlPlugin({
filepath: path.resolve('./dist/js/*.dll.js'),
includeSourcemap: false,
publicPath: '/js',
outputPath: '/js'
}) the generated html is good like this <script type="text/javascript" src="/public/dll/vendor.dll.3cd7cf53.js"> and my directory structure like this |
I have wwwroot folder where I have app, vendor folders. Webpack output folder is app, but i am also adding vendor files from vendor folder into html with your plugin. For some reason plugin copies specified files from wwwroot/vendor to wwwroot/app. My html refs directs to wwwroot/vendor folder as I want it to be, but what for I need this duplicate files?
The text was updated successfully, but these errors were encountered: