Skip to content

Commit 984ff3e

Browse files
authored
fix: vue 2 example source map (#248)
1 parent c828e92 commit 984ff3e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rspack/vue2-ts/rspack.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const { rspack } = require('@rspack/core');
22
const { VueLoaderPlugin } = require('vue-loader');
3+
const path = require('path');
4+
5+
const toPosixPath = (filepath) => (path.sep === '/' ? filepath : filepath.replace(/\\/g, '/'));
36

47
/** @type {import('@rspack/cli').Configuration} */
58
const config = {
@@ -10,7 +13,11 @@ const config = {
1013
devServer: {
1114
historyApiFallback: true,
1215
},
13-
devtool: false,
16+
output: {
17+
// ensure the source map is correct for .vue files
18+
devtoolModuleFilenameTemplate: (info) => toPosixPath(info.absoluteResourcePath),
19+
},
20+
devtool: process.env.NODE_ENV === 'development' ? 'cheap-module-source-map' : false,
1421
plugins: [
1522
new VueLoaderPlugin(),
1623
new rspack.HtmlRspackPlugin({
@@ -30,7 +37,6 @@ const config = {
3037
test: /\.ts$/,
3138
loader: 'builtin:swc-loader',
3239
options: {
33-
sourceMap: true,
3440
jsc: {
3541
parser: {
3642
syntax: 'typescript',

0 commit comments

Comments
 (0)