pull request commentvitejs/vite
Most of the fails are type incompatibility errors.
This analog fail might be a bug in rollup. https://github.com/vitejs/vite-ecosystem-ci/actions/runs/6363871721/job/17279764712#step:8:866
comment created time in 4 hours
push eventsapphi-red/vite
commit sha 49dafa016e6ab23482b9fe529b9bceeff63906af
wip: default of skipSelf is now true
commit sha 176f6d52e281ec26047861fdc2efada15bcb618c
wip: ignore rollup version mismatch type error
push time in 5 hours
Pull request review commentvitejs/vite
-import '@babel/runtime/helpers/esm/slicedToArray'+import '@babel/runtime/helpers/esm/slicedToArray'
Removed the DOM temporary to make the tests pass.
comment created time in 5 hours
Pull request review commentvitejs/vite
function isRefIdentifier(id: Identifier, parent: _Node, parentStack: _Node[]) { const isStaticProperty = (node: _Node): node is Property => node && node.type === 'Property' && !node.computed -const isStaticPropertyKey = (node: _Node, parent: _Node) =>- isStaticProperty(parent) && parent.key === node+const isStaticPropertyKey = (node: _Node, parent: _Node, prop: string) =>+ isStaticProperty(parent) && prop === 'key' && parent.key === node
In acorn, when a property is shorthand version (e.g. const foo = { bar }
), key
and value
has a different reference. But in rollup v4, those have a same reference.
https://stackblitz.com/edit/node-duaz1w?file=index.js
So it wasn't possible to check whether the node
is the key of the parent
or it is the value of it.
comment created time in 5 hours
push eventsapphi-red/vite
commit sha 2ae5044732c0634a596b5f5fb55a7d7936da256b
wip: default of skipSelf is now true
commit sha ef728b962190a6a45da69a26ec25c7fcb58805ac
wip: ignore rollup version mismatch type error
push time in 5 hours
push eventsapphi-red/vite
commit sha ddde37fbd93986808c1a4a00cf8f6e25a56509b2
wip: bump rollup for plugin-legacy
push time in 6 hours
PR opened vitejs/vite
Description
This PR upgrades Rollup to v4.
Remaining TODOs:
- [ ] Check if
this.addWatchFile
is needed in other places - [ ] Revert "remove utf8 BOM for now" commit once https://github.com/rollup/rollup/issues/5162 is fixed
- [ ] Wait for rollup v4 to be released and bump version in
package.json
- [ ] Wait for rollup-plugins compatible with Rollup v4 to be released
refs https://github.com/rollup/rollup/pull/5140
Additional context
this.parse
Rollup now uses SWC with a custom tree converter (converts SWC AST to ESTree AST) to parse JS.
This PR gets this.parse
from rollup by creating a dummy bundle and uses that in dev. I'm not sure if this is legal 😅
This way we can be 100% compatible with rollup.
The other way is to use acorn in dev. But it seems even if we added both acorn-import-attributes
and acorn-import-assertions
, acorn cannot parse asserts
. So we have to create our own acorn plugin or remove support for either asserts
if we take this way.
What is the purpose of this pull request? <!-- (put an "X" next to an item) -->
- [ ] Bug fix
- [x] New Feature
- [ ] Documentation update
- [ ] Other
Before submitting the PR, please make sure you do the following
- [x] Read the Contributing Guidelines.
- [x] Read the Pull Request Guidelines and follow the PR Title Convention.
- [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123
). - [ ] Ideally, include relevant tests that fail without this PR but pass with it.
pr created time in 6 hours
push eventsapphi-red/vite
commit sha f161d22fbb1b066d212f756327c45303832ce31c
wip: use parse function from rollup
push time in 6 hours
push eventsapphi-red/rollup
commit sha 4e92d60fa90cead39481e3703d26e5d812f43bd1
Deoptimize all parameters when losing track of a function (#5158)
commit sha a6448b99f725d457e35821b73a865b5c4d4c6a61
3.29.4
commit sha fac5f1c1c12dc0409ff090664e305586747dc2f7
chore(deps): lock file maintenance minor/patch updates (#5160) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
push time in 11 hours
issue commentsapphi-red/vite-plugin-static-copy
watcher: Cannot read properties of undefined (reading 'close')
Rollup plugins can be placed under build.rollupOptions.plugins
but Vite plugins cannot be placed.
https://vitejs.dev/guide/api-plugin.html#rollup-plugin-compatibility:~:text=If%20a%20Rollup%20plugin%20only%20makes%20sense%20for%20the%20build%20phase%2C%20then%20it%20can%20be%20specified%20under%20build.rollupOptions.plugins%20instead.%20It%20will%20work%20the%20same%20as%20a%20Vite%20plugin%20with%20enforce%3A%20%27post%27%20and%20apply%3A%20%27build%27
comment created time in 11 hours
push eventsapphi-red/vite
commit sha 5e98fe71f8cf8459ae67f6225a24439640edba11
docs: v4 to v5 migration guide (#14343) Co-authored-by: bluwy <bjornlu.dev@gmail.com>
commit sha cb3ab5f465e0de340c4d8b82603e7ee1489b5b62
ci: use Node 18.17 for Windows due to a bug in Node (#14507)
push time in 13 hours
issue openedrollup/rollup
[v4] Invalid variable name generated when importing from UTF-8 with BOM file
Rollup Version
4.0.0-23
Operating System (or Browser)
Windows
Node Version (if applicable)
18.17.1
Link To Reproduction
https://github.com/sapphi-red-repros/rollup-bom-invalid-variable-name-generated
Expected Behaviour
The generated code is valid.
const msg$1g = 'foo;'
// import from a utf-8 bom file
const msg = 'foo';
console.log(msg, msg$1);
Actual Behaviour
The generated code is invalid.
constmsg$1g = 'foo;'
// import from a utf-8 bom file
const msg = 'foo';
console.log(msg, msg$1);
created time in 13 hours
create barnchsapphi-red-repros/rollup-bom-invalid-variable-name-generated
created branch time in 13 hours
created repositorysapphi-red-repros/rollup-bom-invalid-variable-name-generated
created time in 13 hours
Pull request review commentvitejs/vite
test: cleanup `testConfig.baseRoute` and use `testConfig.previewBase`
export default defineConfig({ port, strictPort: true, },- testConfig: {- baseRoute: '/url-base/',- },
This file is not using relative path, so this can be removed.
comment created time in 14 hours
pull request commentvitejs/vite
test: cleanup `testConfig.baseRoute` and use `testConfig.previewBase`
Renamed to previewBase
and made it test-only.
comment created time in 14 hours
push eventsapphi-red/vite
commit sha 0f6b51e600fdd4efad0a8323fc2f22537b5653ce
chore: reduce diff
push time in 14 hours
push eventsapphi-red/vite
commit sha 7ff3cdfb06119a7ab5eac5e9cfd996212a1bd728
test: use `testConfig.previewBase`
push time in 14 hours
Pull request review commentvitejs/vite
docs: v4 to v5 migration guide
-# Migration from v3+# Migration from v4 -## Rollup 3+## Node.js Support -Vite is now using [Rollup 3](https://github.com/vitejs/vite/issues/9870), which allowed us to simplify Vite's internal asset handling and has many improvements. See the [Rollup 3 release notes here](https://github.com/rollup/rollup/releases/tag/v3.0.0).+Vite no longer supports Node.js 14 / 16 / 17 / 19, which reached its EOL. Node.js 18 / 20+ is now required. -Rollup 3 is mostly compatible with Rollup 2. If you are using custom [`rollupOptions`](../config/build-options.md#rollup-options) in your project and encounter issues, refer to the [Rollup migration guide](https://rollupjs.org/migration/) to upgrade your config.+## Deprecate CJS Node API -## Modern Browser Baseline change+The CJS Node API of Vite is deprecated. When calling `require('vite')`, a deprecation warning is now logged. You should update your files or frameworks to import the ESM build of Vite instead. -The modern browser build now targets `safari14` by default for wider ES2020 compatibility (bumped from `safari13`). This means that modern builds can now use [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) and that the [nullish coalescing operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing) isn't transpiled anymore. If you need to support older browsers, you can add [`@vitejs/plugin-legacy`](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) as usual.+In a basic Vite project, make sure: -## General Changes--### Encoding+1. The `vite.config.js` file content is using the ESM syntax.+2. The closest `package.json` file has `"type": "module"`, or use the `.mjs` extension, e.g. `vite.config.mjs`. -The build default charset is now utf8 (see [#10753](https://github.com/vitejs/vite/issues/10753) for details).+For other projects, there are a few general approaches: -### Importing CSS as a String+- **Configure ESM as default, opt-in to CJS if needed:** Add `"type": "module"` in the project `package.json`. All `*.js` files are now interpreted as ESM and needs to use the ESM syntax. You can rename a file with the `.cjs` extension to keep using CJS instead.+- **Keep CJS as default, opt-in to ESM if needed:** If the project `package.json` does not have `"type": "module"`, all `*.js` files are interpreted as CJS. You can rename a file with the `.mjs` extension to use ESM instead.+- **Dynamically import Vite:** If you need to keep using CJS, you can dynamically import Vite using `import('vite')` instead. This requires your code to be written in an `async` context, but should still be manageable as Vite's API is mostly asynchronous. -In Vite 3, importing the default export of a `.css` file could introduce a double loading of CSS.+See the [troubleshooting guide](https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated) for more information. -```ts-import cssString from './global.css'-```+## General Changes -This double loading could occur since a `.css` file will be emitted and it's likely that the CSS string will also be used by the application code — for example, injected by the framework runtime. From Vite 4, the `.css` default export [has been deprecated](https://github.com/vitejs/vite/issues/11094). The `?inline` query suffix modifier needs to be used in this case, as that doesn't emit the imported `.css` styles.+### Allow path containing `.` to fallback to index.html -```ts-import stuff from './global.css?inline'-```+In Vite 4, accessing a path containing `.` did not fallback to index.html even if `appType` is set to `'SPA'` (default).+From Vite 5, it will fallback to index.html. -### Production Builds by Default+Note that the browser will no longer show the 404 error message in the console if you point the image path to a non-existent file (e.g. `<img src="./file-does-not-exist.png">`). -`vite build` will now always build for production regardless of the `--mode` passed. Previously, changing `mode` to other than `production` would result in a development build. If you wish to still build for development, you can set `NODE_ENV=development` in the `.env.{mode}` file.+### Manifest files are now generated in `.vite` directory by default -In part of this change, `vite dev` and `vite build` will not override `process.env.NODE_ENV` anymore if it is already defined. So if you've set `process.env.NODE_ENV = 'development'` before building, it will also build for development. This gives more control when running multiple builds or dev servers in parallel.+In Vite 4, the manifest files (`build.manifest`, `build.ssrManifest`) was generated in the root of `build.outDir` by default. From Vite 5, those will be generated in the `.vite` directory in the `build.outDir` by default. -See the updated [`mode` documentation](https://vitejs.dev/guide/env-and-mode.html#modes) for more details.+### CLI shortcuts require an additional `Enter` press -### Environment Variables+CLI shortcuts, like `r` to restart the dev server, now require an additional `Enter` press to trigger the shortcut. For example, `r + Enter` to restart the dev server. -Vite now uses `dotenv` 16 and `dotenv-expand` 9 (previously `dotenv` 14 and `dotenv-expand` 5). If you have a value including `#` or `` ` ``, you will need to wrap them with quotes.+This change prevents Vite from swallowing and controlling OS-specific shortcuts, allowing better compatibility when combining the Vite dev server with other processes, and avoids the [previous caveats](https://github.com/vitejs/vite/pull/14342). -```diff--VITE_APP=ab#cd`ef-+VITE_APP="ab#cd`ef"-```+## Removed Deprecated APIs -For more details, see the [`dotenv`](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) and [`dotenv-expand` changelog](https://github.com/motdotla/dotenv-expand/blob/master/CHANGELOG.md).+- Default exports of CSS files (e.g `import style from './foo.css'`): Use the `?inline` query instead+- `import.meta.globEager`: Use `import.meta.glob('*', { eager: true })` instead+- `ssr.format: 'cjs`' and `legacy.buildSsrCjsExternalHeuristics`
Sounds good to me. Added 👍
comment created time in 14 hours
push eventsapphi-red/vite
commit sha e7d3d341ebacfb94470dac47240cce180faf3ad6
docs: add discussion link
push time in 14 hours
issue commentvitejs/vite
`npx vite build` breaks module worker instantiation
Are there any changes to Vite or my code that could easily make so that this works out of the box?
Unfortunately, I think there aren't other than fixing https://github.com/vitejs/vite/issues/7015.
comment created time in 15 hours