[@rollup/plugin-terser] Broken sourcemap in v0.2.0
- Rollup Plugin Name: @rollup/plugin-terser
- Rollup Plugin Version: 0.2.0
- Rollup Version: 3.6.0
- Operating System (or Browser): window 10
- Node Version: 16.18.0
- Link to reproduction (β οΈ read below):
Expected Behavior
Generate sourcemap normally
Actual Behavior
Broken source map with Wraning.
- In v0.1.0
{"version":3,"file":"index.js","sources":["../src/errors/RollupBuilderError.ts","../src/errors/OutputError .... ACL,IAG0B,IAAzBH,EAAcN,OAAeM,EAAc,GAAKA,CAAa"}
- In v0.2.0
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
Additional Information
- Rollup Warning message
(!) Broken sourcemap
https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect
Plugins that transform code (such as "terser") should generate accompanying sourcemaps.
created dist in 3.2s
rollup.config
const { DEFAULT_EXTENSIONS } = require('@babel/core');
const resolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const babel = require('@rollup/plugin-babel');
const terser = require('@rollup/plugin-terser');
const cleaner = require('rollup-plugin-cleaner');
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
const typescript = require('rollup-plugin-typescript2');
const ttypescript = require('ttypescript');
const typescriptOptions = {
typescript: ttypescript,
tsconfig: 'tsconfig.json'
};
const babelOptions = {
extensions: [...DEFAULT_EXTENSIONS, '.ts'],
babelHelpers: 'runtime'
};
const resolveOptions = {
browser: true
};
module.exports = {
input: 'src/index.ts',
context: 'window',
output: {
dir: 'dist',
format: 'cjs',
sourcemap: true,
exports: 'named',
name: 'buildRollupOptions'
},
plugins: [
cleaner({ targets: ['dist'] }),
peerDepsExternal(),
resolve(resolveOptions),
typescript({
...typescriptOptions,
tsconfigDefaults: {
compilerOptions: {
outDir: 'dist',
plugins: [
{ "transform": "typescript-transform-paths", "afterDeclarations": true }
]
}
}
}),
commonjs(),
babel(babelOptions),
terser()
]
};
@ChoSeoHwan can you confirm that this is still an issue in v0.2.1 ?
It's still an issue for me in v0.2.1.
I am also experiencing this issue on 0.2.1:
> rollup -c
src/index.ts β dist/index.min.js...
(!) Broken sourcemap
https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect
Plugins that transform code (such as "terser") should generate accompanying sourcemaps.
created dist/index.min.js in 493ms
@brettz9 @maxlapides just to be sure, this "feature" has never worked before, has it?
@tada5hi Well we definitely had sourcemaps before, but I'll be honest: I have never tested to see if they're actually working properly.

@maxlapides ok. I created a draft pull request to implement this feature in the meantime. Need to write some tests and than I think we are good to go βοΈπ
+1 I need sourcemaps for terser
@ivands I think it won't take that long anymore. Tests are added. I'm just waiting for @shellscape to give me feedback resp. accept the changes. Than the feature will be released.
wait for good news
"@rollup/plugin-terser": "^0.2.1",
(!) Broken sourcemap https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect Plugins that transform code (such as "terser") should generate accompanying sourcemaps. created dist/index.js in 904ms
v0.3.0 is released. Can you confirm that the source map generation is working now ?
@tada5hi Thanks so much! Looks like 0.3.0 is perfect. The source map generation on 0.3.0 matches 0.1.0 :)
@maxlapides I'm happy if it works now. I'm always happy to help βοΈβΊοΈ
@shellscape can you close the issue ? @ChoSeoHwan please reopen the issue if the source map generation is still not working for you :v: