vite-node 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +5 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -28,6 +28,8 @@ export async function run(argv) {
|
|
|
28
28
|
|
|
29
29
|
const files = argv.files || argv._
|
|
30
30
|
|
|
31
|
+
const shouldExternalize = argv.shouldExternalize || (id => id.includes('/node_modules/'))
|
|
32
|
+
|
|
31
33
|
const server = await createServer(mergeConfig(argv.defaultConfig || {}, {
|
|
32
34
|
logLevel: 'error',
|
|
33
35
|
clearScreen: false,
|
|
@@ -51,7 +53,7 @@ export async function run(argv) {
|
|
|
51
53
|
|
|
52
54
|
async function run() {
|
|
53
55
|
try {
|
|
54
|
-
await execute(files, server,
|
|
56
|
+
await execute(files, server, shouldExternalize)
|
|
55
57
|
}
|
|
56
58
|
catch (e) {
|
|
57
59
|
console.error(e)
|
|
@@ -108,7 +110,7 @@ function toFilePath(id, server) {
|
|
|
108
110
|
return absolute
|
|
109
111
|
}
|
|
110
112
|
|
|
111
|
-
async function execute(files, server) {
|
|
113
|
+
async function execute(files, server, shouldExternalize) {
|
|
112
114
|
const __pendingModules__ = new Map()
|
|
113
115
|
|
|
114
116
|
const result = []
|
|
@@ -141,7 +143,7 @@ async function execute(files, server) {
|
|
|
141
143
|
? `/${absolute}`
|
|
142
144
|
: absolute
|
|
143
145
|
|
|
144
|
-
if (absolute
|
|
146
|
+
if (shouldExternalize(absolute))
|
|
145
147
|
return import(unifiedPath)
|
|
146
148
|
|
|
147
149
|
const result = await server.transformRequest(id, { ssr: true })
|