Skip to content

Commit

Permalink
test(ssr): add failing external nested cjs test
Browse files Browse the repository at this point in the history
  • Loading branch information
rtsao committed Apr 6, 2023
1 parent ecb3b7f commit 638409a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
12 changes: 12 additions & 0 deletions playground/ssr-deps/nested-external-cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Module with state, to check that it is properly externalized and
// not bundled in the optimized deps
let msg

module.exports = {
setMessage(externalMsg) {
msg = externalMsg
},
getMessage() {
return msg
},
}
7 changes: 7 additions & 0 deletions playground/ssr-deps/nested-external-cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "nested-external-cjs",
"private": true,
"version": "0.0.0",
"main": "index.js",
"type": "commonjs"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { setMessage } from 'nested-external'
import external from 'nested-external-cjs'

setMessage('Hello World!')
external.setMessage('Hello World!')
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"main": "index.js",
"dependencies": {
"nested-external": "file:../nested-external"
"nested-external": "file:../nested-external",
"nested-external-cjs": "file:../nested-external-cjs"
}
}
2 changes: 1 addition & 1 deletion playground/ssr-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@vitejs/test-no-external-cjs": "file:./no-external-cjs",
"@vitejs/test-import-builtin-cjs": "file:./import-builtin-cjs",
"@vitejs/test-no-external-css": "file:./no-external-css",
"@vitejs/test-non-optimized-with-nested-external": "file:./non-optimized-with-nested-external",
"@vitejs/test-non-optimized-with-nested-external": "workspace:*",
"@vitejs/test-optimized-with-nested-external": "file:./optimized-with-nested-external",
"@vitejs/test-optimized-cjs-with-nested-external": "file:./optimized-with-nested-external",
"@vitejs/test-external-using-external-entry": "file:./external-using-external-entry",
Expand Down
23 changes: 13 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 638409a

Please sign in to comment.