Skip to content

Error generating bundle report: Error parsing bundle asset: 'import' and 'export' may appear only with 'sourceType: module' #556

Closed

Description

@eamodio

Issue description

When using the analyzer to generate a report, some of my entry points work, but others report the following errors:

Error parsing bundle asset:  'import' and 'export' may appear only with 'sourceType: module'```

#### Technical info

<!--
Please include the output of running the command below:

npx envinfo --system --binaries --npmPackages='*webpack*' --npmGlobalPackages=webpack-bundle-analyzer 

-->

<pre>
  System:
    OS: Windows 10 10.0.22623
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
    Memory: 14.23 GB / 31.92 GB
  Binaries:
    Node: 18.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    clean-webpack-plugin: 4.0.0 => 4.0.0
    copy-webpack-plugin: 11.0.0 => 11.0.0
    csp-html-webpack-plugin: 5.1.0 => 5.1.0
    css-minimizer-webpack-plugin: 4.2.2 => 4.2.2
    fork-ts-checker-webpack-plugin: 6.5.2 => 6.5.2
    html-webpack-plugin: 5.5.0 => 5.5.0
    image-minimizer-webpack-plugin: 3.8.1 => 3.8.1
    terser-webpack-plugin: 5.3.6 => 5.3.6
    webpack: 5.75.0 => 5.75.0
    webpack-bundle-analyzer: 4.8.0 => 4.8.0
    webpack-cli: 5.0.1 => 5.0.1
    webpack-node-externals: 3.0.0 => 3.0.0
    webpack-require-from: 1.8.6 => 1.8.6
</pre>

#### Debug info
```js
new BundleAnalyzerPlugin({
	analyzerMode: 'static',
	generateStatsFile: true,
	openAnalyzer: false,
	reportFilename: path.join(out, 'webview-bundle-report.html'),
	statsFilename: path.join(out, 'stats.json'),
})

What other Webpack plugins were used?
Many: My webpack.config.js can be found here: https://github.com/gitkraken/vscode-gitlens/blob/daa99a8c6d0557990ec6035f388c0f3458ac35db/webpack.config.js

stats.zip

Activity

  1. valscion commented on Feb 17, 2023

    @valscion
    Collaborator

    Ah I see you have

    		output: {
    			chunkFilename: 'feature-[name].js',
    			filename: '[name].js',
    			libraryTarget: 'module',
    			path: path.join(__dirname, 'dist', 'webviews'),
    			publicPath: '#{root}/dist/webviews/',
    		},
    		experiments: {
    			outputModule: true,
    		},

    in your webpack config, so this issue might be a duplicate of #427

  2. added a commit that references this issue on Jan 8, 2025
  3. added 3 commits that reference this issue on Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions