-
-
Notifications
You must be signed in to change notification settings - Fork 8k
css-post plugins crashes when using transformRequest without first starting a server #3798
Copy link
Copy link
Closed
Labels
Description
Describe the bug
While using the JS API, transformRequest can be used to get transformed versions of js/ts files without starting a server, but when doing the same on css files the css-post plugin crashes with:
❯ node server.js
(node:269183) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
at TransformContext.transform (/home/rasmus/Development/vite-repors/vite-transformRequest-css-crash-repro/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:23139:56)
at Object.transform (/home/rasmus/Development/vite-repors/vite-transformRequest-css-crash-repro/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:44765:53)
at async transformRequest (/home/rasmus/Development/vite-repors/vite-transformRequest-css-crash-repro/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:59029:29)
at async main (/home/rasmus/Development/vite-repors/vite-transformRequest-css-crash-repro/server.js:7:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:269183) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:269183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Reproduction
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:
❯ npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
npx: installed 1 in 0.727s
System:
OS: Linux 5.11 Ubuntu 21.04 (Hirsute Hippo)
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 8.59 GB / 30.99 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Browsers:
Chrome: 91.0.4472.101
Firefox: 89.0
npmPackages:
vite: ^2.3.7 => 2.3.7Used package manager: yarn
Logs
See Repro
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Reactions are currently unavailable