-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't using in Vite2 #257
Comments
this is config you should use import { defineConfig } from 'vite' |
@cxyb I found a way, copy util polyfill as file
|
I found a fix like so: # Shim util module
npm i -D util Vite will auto pick this up without In <script>
globalThis.global = globalThis;
globalThis.process = { env: {} };
</script> in There's 3 issues here:
1 and 3 is related and should be resolved when that issue is resolved. Related discussion: vitejs/vite#8549 |
I don't know what Vite is but if #275 hasn't helped please send pull requests. |
@philsturgeon did you resolve problem with Vite configuration? |
* Init new vite project * Add rendition 35.1.0 * Add browserslist-to-esbuild * Add browsersListToEsbuild config * Add styled-components 6.1.0 * Add whatwg-fetch 3.6.19 * Add husky and lint-staged * Add @types/json-schema * Add promise-polyfill * Copy src from old ui - copy src directory - move public/index.html to index.html - remove %PUBLIC_URL% - add module script to the bottom of the body tag * Use util instead of Node.js util Reference: APIDevTools/json-schema-ref-parser#257 (comment) * Add `start` script to run as old ui * Set default port to 3000 and auto open browser * Remove redundant vite.svg logo * Use `build` instead of `dist` as build output Reason: to match create-react-app output * Only output sourcemap in development mode * Use eslint instead of @balena/lint with lintstaged * Rename project and version * Downgrade husky to v4, lint-staged to v10 * Replace old ui with new vite ui Reason: %PUBLIC_URL% is not used with vite
* Init new vite project * Add rendition 35.1.0 * Add browserslist-to-esbuild * Add browsersListToEsbuild config * Add styled-components 6.1.0 * Add whatwg-fetch 3.6.19 * Add husky and lint-staged * Add @types/json-schema * Add promise-polyfill * Copy src from old ui - copy src directory - move public/index.html to index.html - remove %PUBLIC_URL% - add module script to the bottom of the body tag * Use util instead of Node.js util Reference: APIDevTools/json-schema-ref-parser#257 (comment) * Add `start` script to run as old ui * Set default port to 3000 and auto open browser * Remove redundant vite.svg logo * Use `build` instead of `dist` as build output Reason: to match create-react-app output * Only output sourcemap in development mode * Use eslint instead of @balena/lint with lintstaged * Rename project and version * Downgrade husky to v4, lint-staged to v10 * Replace old ui with new vite ui
* Init new vite project * Add rendition 35.1.0 * Add browserslist-to-esbuild * Add browsersListToEsbuild config * Add styled-components 6.1.0 * Add whatwg-fetch 3.6.19 * Add husky and lint-staged * Add @types/json-schema * Add promise-polyfill * Copy src from old ui - copy src directory - move public/index.html to index.html - remove %PUBLIC_URL% - add module script to the bottom of the body tag * Use util instead of Node.js util Reference: APIDevTools/json-schema-ref-parser#257 (comment) * Add `start` script to run as old ui * Set default port to 3000 and auto open browser * Remove redundant vite.svg logo * Use `build` instead of `dist` as build output Reason: to match create-react-app output * Only output sourcemap in development mode * Use eslint instead of @balena/lint with lintstaged * Rename project and version * Downgrade husky to v4, lint-staged to v10 * Replace old ui with new vite ui
* Init new vite project * Add rendition 35.1.0 * Add browserslist-to-esbuild * Add browsersListToEsbuild config * Add styled-components 6.1.0 * Add whatwg-fetch 3.6.19 * Add husky and lint-staged * Add @types/json-schema * Add promise-polyfill * Copy src from old ui - copy src directory - move public/index.html to index.html - remove %PUBLIC_URL% - add module script to the bottom of the body tag * Use util instead of Node.js util Reference: APIDevTools/json-schema-ref-parser#257 (comment) * Add `start` script to run as old ui * Set default port to 3000 and auto open browser * Remove redundant vite.svg logo * Use `build` instead of `dist` as build output Reason: to match create-react-app output * Only output sourcemap in development mode * Use eslint instead of @balena/lint with lintstaged * Rename project and version * Downgrade husky to v4, lint-staged to v10 * Replace old ui with new vite ui * Revert README changes * Remove redundant HTML comment Reason: %PUBLIC_URL% is not used with vite * Place generated assets inside the `static/assets` Reason: to serve with wifi-connect binary * Only run eslint fix with ts, tsx file with husky * Replace CRA with Vite in README
util is node built-in lib, but not in browser. And vite has no polyfill of node
util
.The text was updated successfully, but these errors were encountered: