Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错 Browser scripts cannot have imports or exports. #45

Closed
luojiyin1987 opened this issue Jan 16, 2023 · 1 comment · Fixed by #46
Closed

报错 Browser scripts cannot have imports or exports. #45

luojiyin1987 opened this issue Jan 16, 2023 · 1 comment · Fixed by #46
Labels

Comments

@luojiyin1987
Copy link

luojiyin1987 commented Jan 16, 2023

系统 Ubuntu 22.04
node 版本 16.19.0
npm 版本 8.19.3

运行 npm start

🚨 Build failed.

@parcel/transformer-js: Browser scripts cannot have imports or exports.

  /home/luo/nodeWork/Web-Conf/source/index.tsx:1:1
  > 1 | import { auto } from 'browser-unhandled-rejection';
  >   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 | import { serviceWorkerUpdate } from 'web-utility/source/event';
    3 | import { render, createCell, documentReady } from 'web-cell';
  
  /home/luo/nodeWork/Web-Conf/source/index.html:19:9
    18 |         <link rel="manifest" href="index.webmanifest" />
  > 19 |         <script src="https://cdn.jsdelivr.net/npm/pwacompat@2.0.17/pwacompat.min.js"></script>
  >    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The environment was originally created here
    20 |         <link
    21 |             rel="stylesheet"

  💡 Add the type="module" attribute to the <script> tag.
  📝 Learn more: https://parceljs.org/languages/javascript/#classic-scripts

期间尝试把 jsderliver 相关cdn 换成 国内的 https://staticfile.org/ 还是有 The environment was originally created here 报错

尝试过 , 给cdn的js 添加 type="module" 还是一样的报错,
不过看了parceljs 文档 像是针对 parcejs 2 的, 本项目安装的是 parcel 1

@TechQuery

@TechQuery
Copy link
Member

详见 #44 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants