xmind-sdk-js
xmind-sdk-js copied to clipboard
Broken sourcemap
- Webpack plugin source-map-loader complains about no such file when bundling
WARNING in ./node_modules/xmind/dist/core/topic.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/xxx/xxx/node_modules/xmind/src/core/topic.ts' file: Error: ENOENT: no such file or directory, open '/home/xxx/xxx/node_modules/xmind/src/core/topic.ts'
@ ./node_modules/xmind/dist/browser.js 17:16-39
- Cannot use debugger to step in functions of the library in browser DevTools, unless turn off
Enable JavaScript source maps
in the DevTools settings.
This can be fixed by
- publish the package with the typescript code
- or use
inlineSources
options in tsconfig to include the code in the sourcemap file - or don't emit the sourcemap at all
Options 1 and 2 will both increase the published size of the package.
- Rollup warns "Broken sourcemap" when bundling
To reproduce, run command npm run rollup
. It seems that rollup-plugin-minification
doesn't return the transformed sourcemap after the minification. Since the plugin is no longer maintained, consider migrating to @rollup/plugin-terser
.
(!) Broken sourcemap
https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect
Plugins that transform code (such as "minification") should generate accompanying sourcemaps.
I will open a draft pr first and push fixes based on your feedback.
#88