• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

写业务组件库遇到的问题

武飞扬头像
ke726
帮助1

[eslint]

D:\my\yi\packages\highAvailability\floatIpDialog.vue  安装jquery,并配置vue.config.js

new webpack.ProvidePlugin({

      $: 'jquery',

      jQuery: 'jquery',

      'windows.jQuery': 'jquery'

    })

  278:32  error  '$' is not defined  no-undef

  279:11  error  '$' is not defined  no-undef

D:\my\yi\src\utils\rules.js    加注释

// eslint-disable-line

  243:48   error  Unnecessary escape character: \  no-useless-escape

✖ 22 problems (22 errors, 0 warnings)

You may use special comments to disable some warnings.

Use // eslint-disable-next-line to ignore the next line.

Use /* eslint-disable */ to ignore all warnings in a file.

 error  in ./src/utils/cipher.js

  安装cnpm i crypto-js

Module not found: Error: Can't resolve 'crypto-js/aes' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/enc-utf8' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/pad-pkcs7' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/mode-ecb' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/md5' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/enc-base64' in 'D:\my\yi\src\utils'

⠼  Building for production as library (commonjs,umd,umd-min)...

 ERROR  Failed to compile with 7 errors                                                                                                                                                                               上午9:21:33

[eslint]

D:\my\yi\packages\highAvailability\floatIpDialog.vue

  278:32  error  '$' is not defined  no-undef

  279:11  error  '$' is not defined  no-undef

D:\my\yi\src\utils\rules.js

  243:48   error  Unnecessary escape character: \  no-useless-escape

✖ 22 problems (22 errors, 0 warnings)

You may use special comments to disable some warnings.

Use // eslint-disable-next-line to ignore the next line.

Use /* eslint-disable */ to ignore all warnings in a file.

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/aes' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/enc-utf8' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/pad-pkcs7' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/mode-ecb' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/md5' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/enc-base64' in 'D:\my\yi\src\utils'

⠋  Building for production as library (commonjs,umd,umd-min)...

 ERROR  Failed to compile with 7 errors                                                                                                                                                                               上午9:21:39

[eslint]

You may use special comments to disable some warnings.

Use // eslint-disable-next-line to ignore the next line.

Use /* eslint-disable */ to ignore all warnings in a file.

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/aes' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/enc-utf8' in 'D:\my\yi\src\utils'

 error  in ./src/utils/cipher.js

Module not found: Error: Can't resolve 'crypto-js/pad-pkcs7' in 'D:\my\yi\src\utils'

 ERROR  Error: Build failed with errors.

Error: Build failed with errors.

    at D:\my\yi\node_modules\_@vue_cli-service@5.0.6@@vue\cli-service\lib\commands\build\index.js:207:23

    at

    at Object.each (D:\my\yi\node_modules\_neo-async@2.6.2@neo-async\async.js:2846:9)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! panke@0.1.0 lib: `vue-cli-service build --target lib packages/index.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the panke@0.1.0 lib script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\DELL\AppData\Roaming\npm-cache\_logs\2022-06-24T01_21_39_609Z-debug.log

PS D:\my\yi>

去掉eslint的校验,在vue.config.js里加上

lintOnSave: false,

 in ./node_modules/panke-component/element/utils/enum.js

把这个文件改成了大json,可能是语法支持的不太好

Module parse failed: Unexpected token (11:23)

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 default class Enum {

>   static businessDirec = ['', '单入', '单出', '双向']

|

|   static userStatus = [

Module parse failed: Unexpected token (12:88)

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

| console.log(window.localStorage)

| console.log("ls.get('Token')=" ls.get('Token'))

> const token = JSON.parse(window.localStorage.getItem('GAP__DEVELOPMENT__4.0.0__TOKEN'))?.value

| // const token = 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTY1NjM4Nzk1OCwiZXhwIjoxNjU2Mzg4NTU4fQ.pJunNyGfz1pxuoP-kl-zPuQ_xmYZyaL6Dj0MPo9wadWbdqFoU1DANhY1QiVza7MkaMK9eK6pIw_lbyAWQR1G3g'

| console.log(token)

需要有一个types/index.d.ts文件,并且配置组件库的packages.json文件

"main": "./lib/component.common.js",

  "typings": "./types/index.d.ts",

无法找到模块“panke-component”的声明文件。“D:/focus/topwab/node_modules/panke-component/lib/component.common.js”隐式拥有 "any" 类型。
尝试使用 `npm i --save-dev @types/panke-component` (如果存在),或者添加一个包含 `declare module 'panke-component';` 的新声明(.d.ts)文件

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfheia
系列文章
更多 icon
同类精品
更多 icon
继续加载