ice icon indicating copy to clipboard operation
ice copied to clipboard

vite模式下打包报错:Unexpected token (Note that you need plugins to import files that are not JavaScript)

Open caoxuccc opened this issue 2 years ago • 3 comments

What is the current behavior? 发生了什么?

Unexpected token (Note that you need plugins to import files that are not JavaScript)
file: /Users//Desktop/work/project/monitor/infusion_monitor/node_modules/.pnpm/@[email protected]/node_modules/@alifd/validate/lib/main.scss?commonjs-proxy:2:15
1: import * as main from "/Users//Desktop/work/project/monitor/infusion_monitor/node_modules/.pnpm/@[email protected]/node_modules/@alifd/validate/lib/main.scss"; import {getAugmentedNamespace} from "commonjsHelpers.js"; export default /*@__PURE__*/getAugmentedNamespace(main);

image

What is the expected behavior? 期望的结果是什么?

正常打包

Any additional comments? 相关环境信息?


- **ice.js Version*2.6.4*:
- **build.json Configuration**:

module.exports = { vite: { }, hash: true, publicPath: './', postcssOptions: { plugins: { 'postcss-nested': {}, 'postcss-px2vw': { viewportWidth: 1080, viewportHeight: 1920, mediaQuery: true, }, }, }, mock: {}, plugins: [ ['build-plugin-moment-locales', { locales: ['zh-cn', 'en-au'] }], // ['build-plugin-ignore-style', { libraryName: '@alifd/theme-mxs-dark' }], ['build-plugin-keep-alive'], [ 'build-plugin-ice-i18n', { locales: ['zh-CN', 'en-US'], defaultLocale: 'en-US', // 关闭国际化路由 i18nRouting: false, // autoRedirect: true, }, ], [ 'build-plugin-fusion', { themePackage: '@alifd/theme-mxs-dark', }, ], ], };

- **Node Version**:14.17.1
- **Platform**:web

caoxuccc avatar Jul 07 '22 08:07 caoxuccc

在pnpm monorepo环境下会出现该问题,使用yarn,单独运行正常

caoxuccc avatar Jul 07 '22 13:07 caoxuccc

这个 case 最好提供个复现 demo

ClarkXia avatar Jul 13 '22 10:07 ClarkXia

@ClarkXia demo:https://github.com/CX330-jiuxi/vite-build-error.git pnpm: 7.x 开启vite情况下,直接根路径 pnpm build 会报错 image

caoxuccc avatar Jul 15 '22 03:07 caoxuccc