-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcemap warning #1
Comments
Can you provide the rollup configuration file? |
import path from 'path';
import nodeResolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import replace from 'rollup-plugin-replace';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import visualizer from 'rollup-plugin-visualizer';
import { terser } from 'rollup-plugin-terser';
import banner from 'rollup-plugin-banner';
import pkg from './package.json';
const BANNER = `
@license
xxx - xxx.js - ${pkg.version}
Released under the ISC License!.
`;
const SOURCE_DIR = path.resolve(__dirname, 'src');
const DIST_DIR = path.resolve(__dirname, 'dist');
const BUILD_NAME = 'gergr';
const baseConfig = {
input: `${SOURCE_DIR}/index.js`,
plugins: [
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
nodeResolve({
jsnext: true
}),
babel({
exclude: '**/node_modules/**'
}),
banner(BANNER),
filesize()
]
};
const esConfig = Object.assign({}, baseConfig, {
output: {
file: `${DIST_DIR}/${BUILD_NAME}.es.js`,
format: 'esm',
sourcemap: true
},
external: [...Object.keys(pkg.peerDependencies), ...Object.keys(pkg.dependencies)]
});
const cjsConfig = Object.assign({}, esConfig, {
output: {
file: `${DIST_DIR}/${BUILD_NAME}.cjs.js`,
format: 'cjs',
sourcemap: true
},
plugins: [
...esConfig.plugins,
visualizer({
filename: './stats/stats.html',
title: 'gregreger - Stats'
})
]
});
const globals = {
react: 'React',
'react-dom': 'ReactDom',
'styled-components': 'styled'
};
const umdConfig = Object.assign({}, baseConfig, {
output: {
name: 'gergerg',
file: `${DIST_DIR}/${BUILD_NAME}.js`,
exports: 'named',
sourcemap: false,
format: 'umd',
globals
},
external: Object.keys(globals),
plugins: [...baseConfig.plugins, nodeResolve({ browser: true }), commonjs()]
});
const minConfig = Object.assign({}, umdConfig, {
output: {
...umdConfig.output,
sourcemap: true,
file: `${DIST_DIR}/${BUILD_NAME}.min.js`
},
plugins: [
terser({
ie8: true,
safari10: true,
numWorkers: 1,
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false
},
output: {
comments(node, comment) {
const { type, value } = comment;
if (type === 'comment2') return /@preserve|@license|@cc_on/i.test(value);
return false;
}
}
}),
...umdConfig.plugins
]
});
export default [esConfig, cjsConfig, umdConfig, minConfig]; |
same issue here |
I'm getting the same issue (https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect). Here's a smaller repro rollup config file: import banner from 'rollup-plugin-banner';
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'cjs',
sourcemap: true
},
plugins: [
// Declare shebang
banner('#/usr/bin/env node')
]
}; See riot/rollup-plugin-riot@aada8ae for an example fix by another rollup plugin. |
It would be really nice to see this resolved. I currently can't generate source maps for my minified scripts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When run: rollup -c and rollup -c -w
It says:
(!) Broken sourcemap
https://rollupjs.org/guide/en#warning-sourcemap-is-likely-to-be-incorrect
Plugins that transform code (such as 'banner') should generate accompanying sourcemaps
Rollup version: 1.0.2
The text was updated successfully, but these errors were encountered: