Closed xmsz closed 2 years ago
报错可以提供下复现代码么
报错可以提供下复现代码么
复现第一个问题this.setState is not a function
,就是默认新建的项目就可以复现
npm init rax demo-2021122701
cd demo-2021122701
npm install
// build.json
{
"targets": ["web"],
"webpack5": true,
"swc": true,
"plugins": []
}
npm run build
然后用浏览器打开构建出来的文件就行
报错可以提供下复现代码么
复现Module not found: Error: Can't resolve './random'
,就是
npm i random
import random from 'random'
就可以复现,webpack4构建没问题
ok 我来试下
"minify": {
"type": "esbuild"
},
背景
ncaught (in promise) TypeError: this.setState is not a function at a.ma.h (index.js:1) at M.e..e. (index.js:1)
at index.js:1
at index.js:1
at Array.map ()
at Object.a [as triggerHandles] (index.js:1)
at index.js:1
ERR! Module not found: Error: Can't resolve './random' in '/Users/chenshijian/code/act-20211020/node_modules/.pnpm/random@3.0.6/node_modules/random/dist/esm' ERR! Did you mean 'random.js'? ERR! BREAKING CHANGE: The request './random' failed to resolve only because it was resolved as fully specified ERR! (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). ERR! The extension in the request is mandatory for it to be fully specified. ERR! Add the extension to the request. ERR! webpack compile error Error: webpack compile error
530.746260a7e03294009d99.js:1 Uncaught (in promise) ReferenceError: exports is not defined