Skip to content

swc-loader: How to get sourceMaps to get generated? #51

@Crismon96

Description

@Crismon96

I would like to generate sourceMaps for my bundling when running src-loader. The config allows to specify the sourceMaps option but it's just not generated. This is my web pack configuration:

baseConfig {
  entry: '/Users/christophgriehl/code/predium/apps/backend/src/main.ts',
  devtool: false,
  target: 'node',
  output: { filename: 'main.js' },
  ignoreWarnings: [ /^(?!CriticalDependenciesWarning$)/ ],
  externals: [ [Function (anonymous)] ],
  externalsPresets: { node: true },
  module: { rules: [ [Object] ] },
  resolve: {
    extensions: [ '.tsx', '.ts', '.js' ],
    plugins: [ [TsconfigPathsPlugin] ]
  },
  mode: 'production',
  optimization: { minimize: true, minimizer: [ [TerserPlugin] ] },
  node: { __dirname: false, __filename: false },
  plugins: [
    IgnorePlugin {
      options: [Object],
      checkIgnore: [Function: bound checkIgnore]
    }
  ],
  cache: {
    type: 'filesystem',
    cacheDirectory: '/Users/christophgriehl/code/predium/apps/backend/.build_cache',
    allowCollectingMemory: true
  }
}

The bundle is correctly generated and runs smoothly but there are just no source maps even though they are specified:

baseConfig.module.rules[0].use.options {
  test: /\.tsx?$/u,
  use: {
    loader: 'swc-loader',
    options: { sourceMaps: true, module: [Object], jsc: [Object], minify: true }
  },
  exclude: /(node_modules)/u
}

I am looking for a working solution of someone to make sourceMaps work with swc-loader.

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