ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.31k stars 1.36k forks source link

🧐[问题]snowpack 项目在集成pro-layout 无法运行 #1885

Closed wlc534 closed 3 years ago

wlc534 commented 3 years ago

🧐 问题描述

snowpack 项目在集成pro-layout 无法运行,在集成antd 能正常运行。并且已安装对应插件 plugins: ['@snowpack/plugin-react-refresh', '@snowpack/plugin-dotenv','snowpack-plugin-less'],

[snowpack] ! building dependencies... [snowpack] Failed to load node_modules/@ant-design/pro-layout/es/Header.less Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)

💻 示例代码

import ProLayout, { PageContainer, SettingDrawer } from '@ant-design/pro-layout'; import defaultProps from './_defaultProps';

🚑 其他信息

[snowpack] ! building dependencies... [snowpack] Failed to load node_modules/@ant-design/pro-layout/es/Header.less Unexpected character '@' (Note that you need plugins to import files that are not JavaScript) image

chenshuai2144 commented 3 years ago

配置一下 https://github.com/moonrailgun/snowpack-plugin-less/blob/master/plugin.js

它是支持的,要打开 javascriptEnabled

{
   loader: 'less-loader', 
   options: {
     javascriptEnabled: true 
   }
}
wlc534 commented 3 years ago

@chenshuai2144 打开了 还是报错,javascriptEnabled应该是less-loader 的options? image