Replies: 34 comments 2 replies
|
You can try |
xxxxx package insert "dependencies": {
"xxxxx": "0.0.1"
}yarn dev 🔴 ERROR | Inline JavaScript is not enabled. Is it set in your options? |
|
parcel-bundler/parcel#907 (comment) |
|
@crazyair just tried this example, it seems to work for me: https://github.com/PlasmoHQ/examples/tree/main/with-ant-design The tilde import means from the root of the current project for Plasmo (and latest Parcel), NOT from |
|
|
|
can you give me the project you're trying to use? Or is it antd itself? |
|
Also, if they use |
|
You can install popup.tsx import { ProCard } from '@ant-design/pro-components';
<ProCard title="默认尺寸" extra="extra" tooltip="这是提示" style={{ maxWidth: 300 }}>
<div>Card content</div>
<div>Card content</div>
<div>Card content</div>
</ProCard>🔴 ERROR | The @import path "\~antd/es/style/themes/index.less" is using webpack specific syntax, which isn't supported by Parcel.
To @import files from node\_modules, use "antd/es/style/themes/index.less"
··· |
|
This is a "missing feature" within Parcel's less transformer: https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/less/src/LessTransformer.js#L115 OR more likely, inconsistency with parcel's definition of the Some potential solutions:
@crazyair can you link me the doc for the tilde path import in less? Also, would you be down to investigate and implement a solution? |
NOTE: These examples you're referencing uses |
external project Deleting
🔴 ERROR | Inline JavaScript is not enabled. Is it set in your options? |
Do you have the lessrc option in your project? |
The main project has, but the external project does not |
|
Can you do a bundling of the external project into some plain component, and just import the output inside plasmo and use it that way then? |
you can import directly like |
|
I've tried everything but still haven't solved it 😭 |
no dist,need change less variable |
^ There's a dist directory if you installed the specific |
have you tried hacking the less transformer? Basically, make it align with the way webpack bundle less source as antd. Also I have no idea how other project uses antd-pro unless they have a similar webpack bundler OR postcss plugin to reconfigure those paths. |
|
No problem with webpack or umi |
|
@crazyair in Umi for it to work with latest antd-pro, you also need to hack up the less path on webpack config: https://v3.umijs.org/guide/upgrade-antd-pro-to-umi-3#%E9%85%8D%E7%BD%AE%E5%B1%82%E8%BF%81%E7%A7%BB So yeah for it to work with parcel, you will need to play around with the less transformer as well and maybe handle the antd special case, OR if antd managed to make their convention widespread enough, implement it as default |
|
How is parcel configured and can it be built-in? |
|
Second, I've tried, but I can't |
|
@crazyair I encountered the same problem, the solution is parcel-bundler/parcel#6623 (comment) |
|
|
@crazyair You can use a script similar to the one executed after postinstall. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What happened?
index.less content
@import '~antd/dist/antd.less';Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Microsoft Edge
Relevant log output
But this project is OK
https://github.com/ant-design/parcel-antd/blob/master/src/style/index.less#L1
(OPTIONAL) Contact Details
No response
Code of Conduct
All reactions