1. 程式人生 > >vue報錯: Cannot assign to read only property 'exports' of object '#'

    vue報錯: Cannot assign to read only property 'exports' of object '#'

     剛剛執行一下以前的一個Vue+webpack的demo,執行之後沒有出現想象中的效果,並且報錯

    Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘

    點開錯誤的檔案,標註錯誤的地方是這樣的一段程式碼:

    import {normalTime} from ‘./timeFormat‘;

    module.exports
    ={
      normalTime
    };

    就是module.exports;

    百度查不到,google一查果然有。

    原因是:The code above is ok. You can mix require

     and export. You can‘t mix import and module.exports.

    翻譯過來就是說,程式碼沒毛病,在webpack打包的時候,可以在js檔案中混用require和export。但是不能混用import 以及module.exports。

    因為webpack 2中不允許混用import和module.exports,

    解決辦法就是統一改成ES6的方式編寫即可.

    import {normalTime} from ‘./timeFormat‘;
    
    export default normalTime;

    最後執行成功。

    相關推薦

    vue Cannot assign to read only property 'exports' of object '#<Object>'

     剛剛執行一下以前的一個Vue+webpack的demo,執行之後沒有出現想象中的效果,並且報錯Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object&g

    VueUncaught TypeError: Cannot assign to read only propertyexportsof object’#[Object]‘的解決方法

    發現問題 1,執行一下以前的一個Vue+webpack的 vue仿新聞網站  小專案,報錯 由於自己vue學習不深入,老是這個報錯,找了好久(確切的說是整整一下午^...^)才找到原因 -v- 2,點開錯誤的檔案,標註錯誤的地方是這樣的一段程式碼: 就是&n

    VueUncaught TypeError: Cannot assign to read only propertyexportsof object’#<Object>‘的解決方法

    oid 方法 ids mlu efault 允許 mod gii ack 因為webpack 2中不允許混用import和module.exports , 解決辦法就是統一改成ES6的方式編寫即可. import { copyDeep } from ‘@/lib

    vue執行error:Cannot assign to read only property 'exports' of object '#<Object>'

    用weex做專案的時候,npm start 之後一直報錯error:Cannot assign to read only property 'exports' of object '#<Object>' ,查了好多資料好像是export和import共用了導致不相容引起的 試了好多方法都不行,最

    Vue:Uncaught TypeError: Cannot assign to read only propertyexportsof object’#<Object>‘的解決方法

    出現如題的錯誤時 網路上的解決辦法:點開錯誤的檔案,標註錯誤的地方是這樣的一段程式碼: import {normalTi

    VueUncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

    pac rop space efault type require bject default logs 剛剛運行一下以前的一個Vue+webpack的demo,運行之後沒有出現想象中的效果,並且報錯 Uncaught TypeError: Cannot assign t

    Cannot assign to read only property 'exports' of object '#<Object>'

    tro 小項目 uncaught ann sig 分享 方式 技術 image 運行一下以前的一個Vue+webpack的 vue仿新聞網站 小項目,報錯 由於自己vue學習不深入,老是這個報錯,找了好久(確切的說是整整一下午^...^)才找到原因 -v- Uncaugh

    vue Cannot read property 'xxx' of undefined",但是頁面能渲染上資料

    有時候會遇到給頁面繫結資料的時候,可以繫結成功,但vue warn:xxx屬性of undefined,,,如果本元件只是繫結簡單的資料倒是可以忽略,如果本元件還引入了其他元件或第三方元件,外掛,則就渲染不出來,就需要解決了, <template>

    swoole Cannot assign requested address [99]

    前兩天伺服器切換了網路之後 發下 一個swoole 的服務起不來了 報錯:Cannot assign requested address [99] 先查看了端口占用,發現沒有被佔用,然後在網上找到了這種解釋: 使用 ifconfig 檢視網絡卡繫結的 ip, 只有網絡卡繫結的 ip

    dockerCannot connect to the Docker daemon. Is the docker daemon running on this host?

    docker這種報錯一般情況都是docker未啟動對於這種情況只用重啟docker就行了: service docker restart   還要一種情況則是docker配置檔案出錯按照提示檢視報錯,並找到相應位置進行更改: systemctl status do

    vueComponent template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    顯示 sin ont img root png ima pan 如果 在.vue文件中引入了 element-ui 的 table 和 pagination 組件後,報錯:Component template should contain exactly one root

    微信開發者工具Cannot read property 'Promise' of undefined

    一般提到:                      thirdScriptError    

    Keil uv5安裝packCannot copy PDSC file to ".Download" older

    目錄問題解決總結 問題 給Keil uv5安裝新的器件pack時報錯。本以為是版本問題,因為以前安裝STM32F4的軟體包時因為安裝的包太新了而報錯。於是這次安裝STM32L0系列時就下了好幾個更低版本的包試試,發現還是報錯:Cannot copy psdc f

    vueeslint-disable-next-line to ignore the next line.

    vue專案報錯:Use // eslint-disable-next-line to ignore the next line.Use /* eslint-disable */ to ignore al

    mpvue開發微信小程式,分享按鈕`Cannot read property 'apply' of null`

    用mpvue開發微信小程式,分享按鈕報錯:Cannot read property 'apply' of null thirdScriptError Cannot read property 'appl

    解決React NativeCannot read property 'bindings' of null

    http://www.blogdaren.com/post-2432.html   問題背景: 升級 React Native 0.55.4 -->  React Native 0.56.0 後,執行報錯:Cannot read property 'bindin

    easyui列表查詢Cannot read property 'length' of undefined

    1.問題描述     easyui中datagrid執行loadData方法出現如下異常:Cannot read property 'length' of undefined 2.一開始懷疑是js或者頁面的問題,然後從早上幹到下午,網上各種方法用盡了就是不行!     最後

    【Tensorflow】Cannot interpret feed_dict key as Tensor: The name 'x' refers to an operation, # > no

    問題描述: 我嘗試給一個tensor輸入值的時候報錯: Cannot interpret feed_dict key as Tensor: The name 'x' refers to an operation, not a Tensor. Tensor names mu

    spriing boot 啟動Cannot determine embedded database driver class for database type NONE

    .class sre 5.0 sin via cor pan cep can 最近在學習使用spring boot。使用maven創建好工程,只引用需要用到的spring boot相關的jar包,除此之外沒有任何的配置。 寫了一個最簡單的例子,如下所示: 1 pa

    Luainvalid key to 'next'

    存在 mov valid microsoft ble err 沒有 cti font 1.問題產生的原因是,在一個循環裏對table中的元素先進行置空操作,再進行增加新元素的操作,就會報這個錯誤。 2.比如下面的例子:(當中間的函數足夠復雜並進行封裝了的情況下,不會留意到