esm-dev / esm.sh

A fast, smart, & global CDN for modern(es2015+) web development.
https://esm.sh
MIT License
3.02k stars 146 forks source link

Failed to import - @douyin/semi-ui #393

Open gwsbhqt opened 2 years ago

gwsbhqt commented 2 years ago

Failing module

import * as SemiUI from 'https://esm.sh/@douyinfe/semi-ui'

Error message

Everything seems to be ok, but for .scss style files it hangs up

eg.

for https://esm.sh/v89/@douyinfe/semi-foundation@2.16.0/es2022/lib/es/popover/popover.css.js:

timeout, we are building the package hardly, please try again later!

Additional info

ije commented 2 years ago

where you get the import https://esm.sh/v89/@douyinfe/semi-foundation@2.16.0/es2022/lib/es/popover/popover.css.js ?

gwsbhqt commented 2 years ago

save the following code as a .html suffix file and open it with your browser, and open the browser debugger to observe

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
    </head>
    <body></body>
    <script type="module">
        import * as SemiUI from 'https://esm.sh/@douyinfe/semi-ui'
        console.log(SemiUI)
    </script>
</html>

After waiting for a period of time, you can observe that the files with the .js suffix are loaded successfully, but all the files with the .css.js suffix fail to load, some are hanged for a long time and no response, some report 500, some report 520, some report 521.

image

image

According to the compiled source code, it is found that the .css.js file is directly imported. compiled_code

According to the source code, it is a directly imported .scss file. source_code

image

image

could it be because esm.sh is missing the scss loader?

gwsbhqt commented 2 years ago

By the way, I found a puzzling phenomenon.

I use the Bundle mode import has been unable to build and import success, always time out. But importing using css mode can be successfully imported.

eg.

bundle mode imported always timeout https://esm.sh/@douyinfe/semi-ui?bundle

css mode imported success https://esm.sh/@douyinfe/semi-ui?css -> https://esm.sh/v89/@douyinfe/semi-ui@2.16.1/es2022/semi-ui.css