Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Cannot assign to read only property 'exports' of object #49

Open
2 tasks done
sockball opened this issue Apr 2, 2019 · 2 comments
Open
2 tasks done

Cannot assign to read only property 'exports' of object #49

sockball opened this issue Apr 2, 2019 · 2 comments

Comments

@sockball
Copy link

sockball commented Apr 2, 2019

描述你的问题

  • 使用webpack 4运行时报错
    Cannot assign to read only property 'exports' of object

    追查原因是src/dialog/index.jsimportmodule.exports混用...

    import { config } from '../config/configMgr';
    import { L2Dwidget } from '../index';
    
    ...
    
    module.exports = {
      createDialogElement, displayDialog, hiddenDialog, alertText, showHitokotoLoop
    }
    
  • 使用webpack 4运行时报错
    Identifier 'aE' has already been declared
    Identifier 't' has already been declared

    追查原因是 src/lib/live2d.core.jsfunction aE()function t()确实定义了2次...
    第一次3133-3168
    第二次4871-4906
    考虑去除4871-4906行?live2d.core.js-4871

环境信息(请务必填写下列信息)

  • 设备: [PC]

  • 操作系统: [MACOS]

  • 浏览器 [Chrome 73]

  • live2d-widget: [3.1.3]

  • 我已仔细阅读CONTRIBUTING中的相关内容。

  • 我已仔细阅读README中的相关内容。

@EYHN

@EYHN
Copy link
Collaborator

EYHN commented Apr 6, 2019

请使用webpack3编译此项目。

您可以使用webpack4调用此项目,下面是例子

main.js

const live2d = require('live2d-widget').L2Dwidget;
live2d.init();

webpack.config.js

module.exports = {
  entry: {
    'main': __dirname  + '/main.js'
  },
  mode: 'development',
  output: {
    path: __dirname  + '/dist',
    filename: '[name].js'
  }
}

@sockball
Copy link
Author

sockball commented Apr 8, 2019

@EYHN 没问题了 似乎主要是引入问题... 一直按照此处 API 引入
import {L2Dwidget} from 'live2d-widget/src/index.js'
改成
import { L2Dwidget } from 'live2d-widget'
即可(某版本之前不可...)
这里文档应该更新一下😊

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

No branches or pull requests

2 participants