mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +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,
|
||||
entries: [
|
||||
'src/index',
|
||||
'src/loaders/nuxt-setup'
|
||||
'src/loaders/nuxt-setup-loader'
|
||||
],
|
||||
dependencies: [
|
||||
'@nuxt/kit',
|
||||
|
@ -1,10 +1,9 @@
|
||||
const DEFINE_COMPONENT_VUE = '_defineComponent('
|
||||
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)) {
|
||||
// TODO: Add sourcemap hints
|
||||
code = 'import { defineNuxtComponent as _defineNuxtComponent } from "@nuxt/app"\n' + code.replace(DEFINE_COMPONENT_VUE, DEFINE_COMPONENT_NUXT)
|
||||
code = 'import { defineNuxtComponent as _defineNuxtComponent } from "@nuxt/app";' + 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',
|
||||
use: [{
|
||||
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