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

按照官网快速开始,起不来 #46

Closed
Freedomhxb opened this issue May 6, 2022 · 16 comments · Fixed by #51
Closed

按照官网快速开始,起不来 #46

Freedomhxb opened this issue May 6, 2022 · 16 comments · Fixed by #51
Labels
question Further information is requested

Comments

@Freedomhxb
Copy link

按照官网的快速开始,运行不起来

https://tencent.github.io/tmagic-editor/docs/guide/installation.html#引入-tmagic-editor

1. vue create myapp
2. npm install @tmagic/editor@latest -S  npm install @tmagic/form@latest element-plus -S
3. 在 main.js 引入
4. npm run build 

错误如下
 error  in ./node_modules/@tmagic/form/dist/tmagic-form.es.js

Module parse failed: Unexpected token (113:18)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/conc
epts#loaders
|   }
|   return config(mForm, {
>     values: mForm?.initValues || {},
|     model: props.model,
|     parent: mForm?.parentValues || {},

 @ ./src/main.ts 11:0-37 23:8-17
 @ multi ./src/main.ts

@jia000
Copy link
Collaborator

jia000 commented May 6, 2022

在vue.config.js里加上transpileDependencies: [/@tmagic/]试试看

@jia000 jia000 added the question Further information is requested label May 6, 2022
@Freedomhxb
Copy link
Author

在vue.config.js里加上transpileDependencies: [/@tmagic/]试试看

不行。变成其他的报错了

@jia000
Copy link
Collaborator

jia000 commented May 6, 2022

错误信息发出来看看

@Jack-Xiexx
Copy link

Jack-Xiexx commented May 6, 2022

ERROR in ./node_modules/@tmagic/schema/src/index.ts 19:7
Module parse failed: Unexpected token (19:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| */
|
export enum NodeType {
| CONTAINER = 'container',
| PAGE = 'page',
@ ./node_modules/@tmagic/editor/dist/tmagic-editor.es.js
@ ./src/main.js

我也遇到类似的错误,该如何处理

@jia000
Copy link
Collaborator

jia000 commented May 6, 2022

ERROR in ./node_modules/@tmagic/schema/src/index.ts 19:7
Module parse failed: Unexpected token (19:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| */
|
export enum NodeType {
| CONTAINER = 'container',
| PAGE = 'page',
@ ./node_modules/@tmagic/editor/dist/tmagic-editor.es.js
@ ./src/main.js

我也遇到类似的错误,该如何处理

这个错误就是要加上配置 transpileDependencies: [/@tmagic/]

@qdu123
Copy link

qdu123 commented May 7, 2022

我的报
Uncaught TypeError: Cannot read properties of undefined (reading 'from')
at node_modules/safe-buffer/index.js (index.js:11:12)
at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50)
at node_modules/randombytes/browser.js (browser.js:15:14)
at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50)
at node_modules/serialize-javascript/index.js (index.js:9:19)
at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50)
at events.js:497:1

@SJLgogo
Copy link

SJLgogo commented May 7, 2022

在vue.config.js里加上transpileDependencies: [/@tmagic/]试试看

修改之后还是报错
ERROR in ./node_modules/@tmagic/schema/src/index.ts 19:7
Module parse failed: Unexpected token (19:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| */
|

export enum NodeType {
| CONTAINER = 'container',
| PAGE = 'page',

@jia000
Copy link
Collaborator

jia000 commented May 7, 2022

我的报 Uncaught TypeError: Cannot read properties of undefined (reading 'from') at node_modules/safe-buffer/index.js (index.js:11:12) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at node_modules/randombytes/browser.js (browser.js:15:14) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at node_modules/serialize-javascript/index.js (index.js:9:19) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at events.js:497:1

npm i buffer 应该就可以了,这问题已经解决过了,只是npm包还没发布新的

@jia000
Copy link
Collaborator

jia000 commented May 7, 2022

@SJLgogo 不是ts项目?

@qdu123
Copy link

qdu123 commented May 7, 2022

我的报 Uncaught TypeError: Cannot read properties of undefined (reading 'from') at node_modules/safe-buffer/index.js (index.js:11:12) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at node_modules/randombytes/browser.js (browser.js:15:14) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at node_modules/serialize-javascript/index.js (index.js:9:19) at __require2 (chunk-TMRFOBSY.js?v=32337c56:47:50) at events.js:497:1

npm i buffer 应该就可以了,这问题已经解决过了,只是npm包还没发布新的

感谢感谢!上一个错误解决了,
不过现在出现下面错误
Uncaught ReferenceError: global is not defined
at node_modules/randombytes/browser.js (browser.js:16:14)
at __require2 (chunk-LTPURSQW.js?v=9febb0af:18:50)
at node_modules/serialize-javascript/index.js (index.js:9:19)
at __require2 (chunk-LTPURSQW.js?v=9febb0af:18:50)
at events.js:497:1

哪位大佬给个能跑起来的工程,谢谢!

@jia000
Copy link
Collaborator

jia000 commented May 7, 2022

global is not defined
这个问题在已经修复,等1.0.0-beta.14的包

现在可以通过创建polyfills.ts文件

if (typeof (window as any).global === 'undefined') {
  (window as any).global = window;
}

以上代码放入polyfills.ts中
然后再项目最开头的位置import "polyfills"

@jia000
Copy link
Collaborator

jia000 commented May 7, 2022

1.0.0-beta.14 已发布

@jia000 jia000 closed this as completed May 7, 2022
@jia000 jia000 linked a pull request May 7, 2022 that will close this issue
@SJLgogo
Copy link

SJLgogo commented Oct 11, 2022 via email

@lxt-ing
Copy link

lxt-ing commented Jan 9, 2023

请问一下react+webpack项目遇到这个You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. 要怎么处理呢

@ashen9
Copy link

ashen9 commented Jan 9, 2023

为啥我用的1.2.0版本还是有这个问题
Uncaught ReferenceError: global is not defined
at node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js (browser.js:16:14)
at __require (chunk-FQZ6OWVD.js?v=86dc4da2:11:50)
at node_modules/.pnpm/serialize-javascript@6.0.0/node_modules/serialize-javascript/index.js (index.js:9:19)
at __require (chunk-FQZ6OWVD.js?v=86dc4da2:11:50)
at events.js:497:1

@JustGogoing
Copy link

"@tmagic/design": "^1.2.15",
    "@tmagic/editor": "^1.2.15",
    "@tmagic/element-plus-adapter": "^1.2.15",
    "@tmagic/form": "^1.2.15",
    "@tmagic/stage": "^1.2.15",
    "element-plus": "^2.3.8",
    "pinia": "^2.1.4",
    "vue": "^3.3.4",
    "vue-router": "^4.2.4"

问题依然存在,使用polyfills解决

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

Successfully merging a pull request may close this issue.

8 participants