Skip to content

Conversation

@alessandro308
Copy link

Since we are using raw-loader to load HTML file, it returns an object with the default properties to be compatible with ES6 standard. This tool uses ES5 syntax ( required(..) ) so we need to access to default value explicitly.

Another possible solution, instead of these changes, is to upgrade raw-loader to 4.0.0 and use esModules: false properties but this introduces two different problems:

  • our build toolchain uses a node version not supported by raw-loader 4.x (it required node >= 10.13)
  • you your toolchain uses raw-loader to manage other types of import, forcing it to use esModules:false can be too much restrictive

@ximon
Copy link

ximon commented Oct 15, 2021

If using webpack 5 you can use the asset/resource loader:

{ test: /\.html$/, type: 'asset/source' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants