Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

ESM target file support #80

@RyanClementsHax

Description

@RyanClementsHax

Feature Proposal

Feature Use Case

After careful searching of the web, it seems that val-loader does not support target files expressed as esm. What do you think about adding this ability? In short, it would allow us to express target files as such:

export default (options, loaderContext) => {
  return { code: "module.exports = 42;" };
};

Right now it fails with the following error Unable to execute "<the file name>": SyntaxError: Unexpected token 'export'

I tried to find if any related work has been done on this before submitting this request and the closest seems to be this issue #13 for reference

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
OS: Linux 4.19 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 1.49 GB / 7.72 GB
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 3.1.0 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Packages:
css-loader: ^6.5.0 => 6.5.0
postcss-loader: ^6.1.1 => 6.2.0
sass-loader: ^12.3.0 => 12.3.0
style-loader: ^3.3.1 => 3.3.1
val-loader: ^4.0.0 => 4.0.0
webpack: ^5.60.0 => 5.60.0

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