-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: add ability to build static bundle (#93)
- Loading branch information
Showing
10 changed files
with
275 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,28 +19,34 @@ | |
"primus": "^7.3.5", | ||
"primus-emit": "^1.0.0", | ||
"update-dotenv": "^1.1.1", | ||
"vite": "^1.0.0-rc.4", | ||
"vite": "1.0.0-rc.4", | ||
"vite-plugin-react": "^3.0.2", | ||
"ws": "^7.3.1" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.4.0", | ||
"@typescript-eslint/parser": "^4.4.0", | ||
"bs-platform": "^8.2.0", | ||
"eslint": "^7.11.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"eslint-plugin-react-hooks": "^4.1.2", | ||
"eslint-plugin-react": "^7.21.4", | ||
"eslint": "^7.11.0", | ||
"eslint-plugin-react-hooks": "^4.1.2", | ||
"neon-cli": "^0.4.2", | ||
"st": "^2.0.0", | ||
"typescript": "^3.7.2" | ||
}, | ||
"resolutions": { | ||
"vite": "npm:@phated/[email protected]" | ||
}, | ||
"scripts": { | ||
"start": "node .", | ||
"prepare": "yarn build", | ||
"build": "yarn re:build && yarn rust:build", | ||
"re:build": "bsb -make-world", | ||
"re:watch": "bsb -make-world -w", | ||
"re:clean": "bsb -clean-world", | ||
"rust:build": "neon build --release" | ||
"rust:build": "neon build --release", | ||
"static:build": "vite build", | ||
"static:serve": "st -p 8083 -d dist -i index.html -nc" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const path = require('path'); | ||
const VitePluginReact = require('vite-plugin-react'); | ||
|
||
const viteConfig = ({ port = 8082, ...rest }) => ({ | ||
root: path.join(__dirname, 'client'), | ||
alias: { | ||
'react': '@pika/react', | ||
'react-dom': '@pika/react-dom', | ||
'auto-bind': 'auto-bind/index', | ||
'crypto': 'crypto-browserify', | ||
'http': 'http-browserify', | ||
'https': 'https-browserify', | ||
'stream': 'stream-browserify', | ||
}, | ||
jsx: 'react', | ||
optimizeDeps: { | ||
include: ['auto-bind/index', 'stylis-rule-sheet'], | ||
}, | ||
env: { | ||
PORT: port, | ||
}, | ||
// Explictly don't add the plugin resolvers because | ||
// we want prod React to make warnings go away | ||
// resolvers: [...VitePluginReact.resolvers], | ||
configureServer: [VitePluginReact.configureServer], | ||
transforms: [...VitePluginReact.transforms], | ||
...rest | ||
}); | ||
|
||
// Only for build | ||
module.exports = viteConfig({ | ||
outDir: path.join(__dirname, 'dist'), | ||
rollupInputOptions: { | ||
external: ['/primus/primus.js', '/snarkjs.min.js'] | ||
}, | ||
}); | ||
module.exports.viteConfig = viteConfig; |
Oops, something went wrong.