unplugin-sourcemaps
v0.1.2
Published
Universal plugin for loading existing source maps from imported modules. Works with Vite, Rollup, webpack, and esbuild.
Downloads
20
Maintainers
Readme
unplugin-sourcemaps
Universal plugin for loading existing source maps from imported modules.
Works with Vite, Rollup, esbuild, and Webpack.
Installation
Start by installing the package:
npm install unplugin-sourcemaps --save-dev
Then register the bundler-specific plugin and enable the source maps.
// vite.config.js
import { defineConfig } from 'vite';
import { ViteSourcemap } from 'unplugin-sourcemaps';
export default defineConfig( {
plugins: [
ViteSourcemap()
],
build: {
sourcemap: true
}
} );
// rollup.config.js
import { defineConfig } from 'rollup';
import { RollupSourcemap } from 'unplugin-sourcemaps';
export default defineConfig( {
output: {
// Other options are skipped for brevity
sourcemap: true,
},
plugins: [
RollupSourcemap()
]
} );
import { build } from 'esbuild';
import { EsbuildSourcemap } from 'unplugin-sourcemaps';
build( {
sourcemap: true,
plugins: [
SondaEsbuildPlugin()
]
} );
// webpack.config.js
const { WebpackSourcemap } = require( 'unplugin-sourcemaps' );
module.exports = {
devtool: 'source-map',
plugins: [
WebpackSourcemap()
],
};