Skip to content

Source maps aren't added to .mjs output files #7927

Description

@philipwalton

Bug report

What is the current behavior?

Source maps don't get added when defining an output file with an mjs extension. If I change nothing about my config except for the output extension from mjs to js, it works as expected.

If the current behavior is a bug, please provide the steps to reproduce.

Here's a minimal repo:

webpack.config.js:

const webpack = require("webpack");
const path = require('path');

module.exports = {
  mode: 'development',
  entry: {
    main: "./main.mjs"
  },
  output: {
    path: path.resolve(__dirname),
    filename: "[name].[chunkhash].mjs",
  },
  devtool: '#source-map',
};

main.mjs:

console.log('Hello World');

Other relevant information:
webpack version: 4.17.0
Node.js version: 10.8
Operating System: MacOS 10.13.6
Additional tools: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedMaintainers welcome a community PR for this

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions