airyland / vux-loader

hack into vue-loader
64 stars 37 forks source link

安装vux-loader 引入包失败 #2

Closed wengcd closed 7 years ago

wengcd commented 7 years ago

根据文档安装vux-loader

  ✘  https://google.com/#q=import%2Fno-unresolved  Unable to resolve path to module 'vux'  
  /Users/Matt/workspace/webei/daodian/src/routes/pay/index.vue:69:29
  import { Group, Cell } from 'vux';
                               ^
  ✘  https://google.com/#q=import%2Fextensions     Missing file extension for "vux"        
  /Users/Matt/workspace/webei/daodian/src/routes/pay/index.vue:69:29
  import { Group, Cell } from 'vux';

生效但是没样式

import Group from 'vux/dist/components/group';
import Cell from 'vux/dist/components/cell';

以下方式生效

import Group from 'vux/src/components/group';
import Cell from 'vux/src/components/cell';
airyland commented 7 years ago

在webpack里配置vux-loader 的vux-ui这个插件了吗

wengcd commented 7 years ago

配置了

module.exports = vuxLoader.merge(webpackConfig, {
  plugins: [
    {
      name: 'vux-ui'
    },
    {
      name: 'duplicate-style'
    }
  ]
})

我就在官方template基础上改了baseconfig,和装了相关依赖

airyland commented 7 years ago

你用的是eslint哪个标准?

wengcd commented 7 years ago
const router = new VueRouter({
  scrollBehavior,
  mode: 'history',
  routes: [{
    path: '/home',
    name: 'home',
    component: r => require.ensure([], () => r(require('./home')), 'home')
  }, {
    path: '/pay',
    name: 'pay',
    component: r => require.ensure([], () => r(require('./pay')), 'pay')
  }, {
    path: '/coupons',
    name: 'coupons',
    component: r => require.ensure([], () => r(require('./coupons')), 'coupons')
  }, { path: '*', redirect: '/pay' }]
});

是我主入口代码分割的问题?

airyland commented 7 years ago

你初始化时选的eslint是 airbnb对吧,目测是 airbnb 的eslint 超严格配置

airyland commented 7 years ago
  'rules': {
    // don't require .vue extension when importing
    'import/extensions': ['off', 'always', { // 设为 off
      'js': 'never',
      'vue': 'never'
    }],
    'import/no-unresolved': [0, {commonjs: true, amd: true}], // 添加这一行
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
wengcd commented 7 years ago

原来如此。。解决了。。

Chenflash commented 6 years ago

楼主,你是怎么解决的。我的报错是这样,Can't resolve 'vux' in 'D:\Work\VueJs\ThisProject\src\components'