Skip to content

Commit dfdc815

Browse files
committed
fix: passthrough sourcemaps
fixes #233
1 parent c5e01f5 commit dfdc815

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

dev/vite.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import vue from '@vitejs/plugin-vue'
22
import vuetify from 'vite-plugin-vuetify'
33
import path from 'path'
44
import Inspect from 'vite-plugin-inspect'
5+
import { defineConfig } from 'vite'
56

6-
export default {
7+
export default defineConfig(({ command }) => ({
78
root: path.resolve(__dirname, 'src'),
89
plugins: [
910
vue(),
10-
vuetify({ styles: 'expose' }),
11+
vuetify({ styles: 'expose', autoImport: true }),
1112
{
1213
name: 'configure-server',
1314
configureServer(server) {
@@ -22,10 +23,12 @@ export default {
2223
// Inspect(),
2324
],
2425
build: {
26+
sourcemap: true,
27+
minify: false,
2528
outDir: '../dist',
2629
emptyOutDir: true,
2730
rollupOptions: {
28-
input: 'index.vite.html'
31+
input: { build: 'src/index.vite.html', serve: 'index.vite.html' }[command],
2932
}
3033
},
3134
resolve: {
@@ -43,4 +46,4 @@ export default {
4346
optimizeDeps: {
4447
exclude: ['vuetify']
4548
}
46-
}
49+
}))

packages/vite-plugin/src/importPlugin.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ export function importPlugin (): Plugin {
2222
},
2323
async transform (code, id) {
2424
const { query, path } = parseId(id)
25-
if (extname(path) === '.vue' && !query) {
26-
if (/^import { render as _sfc_render } from ".*"$/m.test(code)) {
27-
return null
28-
}
2925

26+
if (
27+
(!query && extname(path) === '.vue' && !/^import { render as _sfc_render } from ".*"$/m.test(code)) ||
28+
(query && 'vue' in query && query.type === 'template')
29+
) {
3030
const { code: imports, source } = generateImports(code)
31-
return source + imports
32-
} else if (query && 'vue' in query && query.type === 'template') {
33-
const { code: imports, source } = generateImports(code)
34-
return source + imports
31+
return {
32+
code: source + imports,
33+
map: null,
34+
}
3535
}
3636

3737
return null

packages/vite-plugin/src/stylesPlugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ export function stylesPlugin (options: Options): Plugin {
168168
await awaitResolve(id)
169169
debug(`returning ${id}`)
170170

171-
return code.replace(styleImportRegexp, '$1".cache/vuetify/styles.scss"')
171+
return {
172+
code: code.replace(styleImportRegexp, '$1".cache/vuetify/styles.scss"'),
173+
map: null,
174+
}
172175
}
173176
},
174177
load (id) {

0 commit comments

Comments
 (0)