vite配置vite-plugin-style-import插件后启动报错
作者:互联网
我报错了
external = resolvedConfig?.build?.rollupOptions?.external ?? void 0; ^ SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (/Users/wangping/project/vite-vue3-ts-learn/vite.config.ts:29:39) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.require.extensions.<computed> [as .ts] (/Users/wangping/project/vite-vue3-ts-learn/node_modules/vite/dist/node/chunks/dep-611778e0.js:61506:20)
不管报什么错,大部分是因为 node版本不够,至少是node 14+的版本才可以,我使用的是node v12.2.0
换了node版本后重新 npm install,就可以正常启动了。
附插件文档:https://github.com/vbenjs/vite-plugin-style-import
标签:插件,modules,js,internal,报错,cjs,loader,vite 来源: https://www.cnblogs.com/beileixinqing/p/16107732.html