Skip to content

Commit

Permalink
fix: fix cva react template build + handle alias during build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 13, 2020
1 parent 4f2953e commit c243d09
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions create-vite-app/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"dev": "vite serve src --jsx react",
"build": "vite build src --jsx react"
"build": "vite build src --jsx react --outDir dist "
},
"dependencies": {
"@pika/react": "^16.13.1",
Expand All @@ -12,4 +12,4 @@
"devDependencies": {
"vite": "^0.14.3"
}
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
"ws": "^7.2.3"
},
"devDependencies": {
"@pika/react": "^16.13.1",
"@pika/react-dom": "^16.13.1",
"@types/es-module-lexer": "^0.3.0",
"@types/fs-extra": "^8.1.0",
"@types/hash-sum": "^1.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/node/build/buildPluginResolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const createBuildResolvePlugin = (
): Plugin => {
return {
name: 'vite:resolve',
async resolveId(id: string) {
async resolveId(id, importer) {
id = resolver.alias(id) || id
if (id === hmrClientId) {
return hmrClientId
Expand Down Expand Up @@ -44,6 +44,8 @@ export const createBuildResolvePlugin = (
}
}
// fallback to node-resolve
const resolved = this.resolve(id, importer, { skipSelf: true })
return resolved || { id }
},
load(id: string) {
if (id === hmrClientId) {
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,16 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@pika/react-dom@^16.13.1":
version "16.13.1"
resolved "https://registry.yarnpkg.com/@pika/react-dom/-/react-dom-16.13.1.tgz#8e684617ea2e3e0741e418954f74e8ec1c93f81d"
integrity sha512-tCROpA6uP7caCNodaOUcqmauQmpVOmFXsaaKUJgLOMiZdlW+L02ItK3WAqGSOw25rM0bbwDXNC/x9PpfiQ9ESg==

"@pika/react@^16.13.1":
version "16.13.1"
resolved "https://registry.yarnpkg.com/@pika/react/-/react-16.13.1.tgz#20e47997d2a2f1e5da39a8e28b75db2ec77d99c6"
integrity sha512-v33Ub2QxntNpDFRnkj3tCbT6jMb7Etu7LOMQO/YAulLRIDtDvJdMwuOVJDdPYUmDtWjfWOB5xSP7nl7k0BApbQ==

"@rollup/[email protected]":
version "11.0.2"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz#837cc6950752327cb90177b608f0928a4e60b582"
Expand Down

0 comments on commit c243d09

Please sign in to comment.