import from 相對路徑

項目目錄前端

- server
- static
- src
-  -  stroe
-  -  router
-  -  main.js
-  app.js

src爲前端文件,src目錄下有main.js代碼以下vue

import Vue from 'vue'
    import NProgress from 'vue-nprogress'
    import router from router;
    import store from store;
    new Vue({
      router,
      store,
      nprogress: new NProgress({parent: '.nprogress-container'}),
      ...App
    }).$mount('mainbody')

webpack打包報錯,找不到router和storenode

解決方案,webpack沒有設置src爲根目錄查找模塊webpack

resolve: {
        modules: [
            path.resolve('./src'),
            path.resolve('./node_modules')
        ]
    }
相關文章
相關標籤/搜索