I’ve encountered two issues while configuring Webpack for developing an Adobe Express add-on:
-
Source Maps Generated in Production:
Despite setting mode: "production", Webpack continues to generate .js.map files. This unnecessarily increases bundle size and may expose source code.
-
Manual Public Folder Specification:
When using CopyWebpackPlugin, I had to manually specify the public folder. Ideally, Webpack should handle this dynamically and not throw an error if the folder is missing.
Why the Public Folder Matters for Adobe Express Add-ons:
Adobe Express add-ons often require storing static assets such as JSON configuration files, icons, and other resources. The public folder serves as a place for these assets, ensuring they are included in the final build without being processed by Webpack. Having a reliable and error-free way to include these files is essential for seamless integration with Adobe Express.
Steps to Reproduce:
- Configure Webpack with
mode: "production".
- Run
webpack --mode production.
- Observe that
.js.map files are still generated in the output directory.
- There is no Public folder in src folder
Expected Behavior:
.js.map files should not be generated in production unless explicitly enabled.
CopyWebpackPlugin Public folder should be added by default into src folder and webpack should copy files and folders inside public into dist
Suggested Solutions:
- Update
devtool to:
devtool: isEnvProduction ? false : "source-map"
This ensures source maps are only generated in development mode.
- Modify
CopyWebpackPlugin to:
new CopyWebpackPlugin({
patterns: [
{ from: path.resolve(__dirname, "src/public"), to: "", noErrorOnMissing: true },
],
})
This prevents errors when the public folder is missing.
Would appreciate any insights on whether this is intended behavior or if improvements can be made. Thank you! 🚀
I’ve encountered two issues while configuring Webpack for developing an Adobe Express add-on:
Source Maps Generated in Production:
Despite setting
mode: "production", Webpack continues to generate.js.mapfiles. This unnecessarily increases bundle size and may expose source code.Manual Public Folder Specification:
When using
CopyWebpackPlugin, I had to manually specify thepublicfolder. Ideally, Webpack should handle this dynamically and not throw an error if the folder is missing.Why the Public Folder Matters for Adobe Express Add-ons:
Adobe Express add-ons often require storing static assets such as JSON configuration files, icons, and other resources. The
publicfolder serves as a place for these assets, ensuring they are included in the final build without being processed by Webpack. Having a reliable and error-free way to include these files is essential for seamless integration with Adobe Express.Steps to Reproduce:
mode: "production".webpack --mode production..js.mapfiles are still generated in the output directory.Expected Behavior:
.js.mapfiles should not be generated in production unless explicitly enabled.CopyWebpackPluginPublic folder should be added by default into src folder and webpack should copy files and folders inside public into distSuggested Solutions:
devtoolto:CopyWebpackPluginto:publicfolder is missing.Would appreciate any insights on whether this is intended behavior or if improvements can be made. Thank you! 🚀