mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: source map for webpack nuxt-setup-loader (#236)
This commit is contained in:
parent
f32af4bdb6
commit
58327824fb
@ -4,7 +4,7 @@ export default defineBuildConfig({
|
|||||||
declaration: false,
|
declaration: false,
|
||||||
entries: [
|
entries: [
|
||||||
'src/index',
|
'src/index',
|
||||||
'src/loaders/nuxt-setup'
|
'src/loaders/nuxt-setup-loader'
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
'@nuxt/kit',
|
'@nuxt/kit',
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
const DEFINE_COMPONENT_VUE = '_defineComponent('
|
const DEFINE_COMPONENT_VUE = '_defineComponent('
|
||||||
const DEFINE_COMPONENT_NUXT = '_defineNuxtComponent('
|
const DEFINE_COMPONENT_NUXT = '_defineNuxtComponent('
|
||||||
|
|
||||||
export default function NuxtSetupLoader (code: string) {
|
export default function NuxtSetupLoader (code: string, map: any) {
|
||||||
if (code && code.includes(DEFINE_COMPONENT_VUE)) {
|
if (code && code.includes(DEFINE_COMPONENT_VUE)) {
|
||||||
// TODO: Add sourcemap hints
|
code = 'import { defineNuxtComponent as _defineNuxtComponent } from "@nuxt/app";' + code.replace(DEFINE_COMPONENT_VUE, DEFINE_COMPONENT_NUXT)
|
||||||
code = 'import { defineNuxtComponent as _defineNuxtComponent } from "@nuxt/app"\n' + code.replace(DEFINE_COMPONENT_VUE, DEFINE_COMPONENT_NUXT)
|
|
||||||
}
|
}
|
||||||
return code
|
this.callback(null, code, map)
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ export default class NuxtSetupTransformerPlugin {
|
|||||||
enforce: 'post',
|
enforce: 'post',
|
||||||
use: [{
|
use: [{
|
||||||
ident: 'NuxtSetupTransformerPlugin',
|
ident: 'NuxtSetupTransformerPlugin',
|
||||||
loader: require.resolve('@nuxt/webpack-builder/dist/nuxt-setup')
|
loader: require.resolve('@nuxt/webpack-builder/dist/nuxt-setup-loader')
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user