Skip to content

Source Maps Generated in Production & Public Folder Handling Issue #27

@ThisIsMrAli

Description

@ThisIsMrAli

I’ve encountered two issues while configuring Webpack for developing an Adobe Express add-on:

  1. 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.

  2. 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:

  1. Configure Webpack with mode: "production".
  2. Run webpack --mode production.
  3. Observe that .js.map files are still generated in the output directory.
  4. 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! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions