rikka

vue-cli 3.0.1 创建的项目该如何引入 Object-Assign-Deep 这个包

  •  
  •   rikka · Sep 7, 2018 · 1866 views
    This topic created in 2810 days ago, the information mentioned may be changed or developed.
    本来项目已经完成了一切正常,最后测试 ie11 报错
    SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
    原来 Object-Assign-Deep 里面有 es6 语法,babel 默认忽略 node_modules 文件夹里面的包
    解决就是 vue.config.js 加入 transpileDependencies: ['object-assign-deep']

    但结果又报错:Cannot assign to read only property 'exports' of object '#<Object>'

    import * as objectAssignDeep from 'object-assign-deep'

    const objectAssignDeep=require('object-assign-deep')
    这 2 种引入姿势都是报错

    查了下似乎是混合使用 import 和 module.exports 导致的

    还有解吗
    包地址是 https://github.com/saikojosh/Object-Assign-Deep
    Supplement 1  ·  Sep 7, 2018
    很无奈,暂时把 Object-Assign-Deep 源码复制进项目里面,然后把他的模块导出方式改成 es6 的方式
    这么一波操作虽然解决问题了,但是我心里很难受 TAT
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2821 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:24 · PVG 22:24 · LAX 07:24 · JFK 10:24
    ♥ Do have faith in what you're doing.