airyland / vux-loader

hack into vue-loader
64 stars 37 forks source link

template or render function #55

Closed hfc-advance closed 6 years ago

hfc-advance commented 6 years ago
module.export = baseConfig;

直接导出配置是可以的

 module.exports = vuxLoader.merge(baseConfig, {
  options:{},
  plugins: [{
    name: 'vux-ui'
  }]
}); 

通过vuxLoader.merge 导出就出现

[Vue warn]: Failed to mount component: template or render function not defined.

hfc-advance commented 6 years ago

const baseConfig = {  
  entry: {
    index: utils.resolve('../src/index')
  },
  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.(vue|js)$/,
        loader: [
          {
            loader: 'eslint-loader',
            options: {
              formatter: eslintFrienylyFormate
            }
          }
        ],
        include: config.projectInclude
      },
      {
        test: /\.vue$/,
        loader: [
          {
            loader: 'vue-loader',
            options: config.vueLoaderOptions
          }
        ],
        include: config.projectInclude
      },
      {
        test: /\.js$/,
        loader: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true
            }
          }
        ],
        include: config.projectInclude
      },
      {
        test: /\.(png|gif|jpg|jpeg)$/,
        loader: [
          {
            loader: 'url-loader',
            options: {
              limit: 1024
            }
          }
        ]
      },
      {
        test: /\.svg$/,
        loader: [
          {
            loader: 'svg-sprite-loader',
            options: {
              options: { extract: true }
            }
          },
          ...svgoLoader
        ]
      }
    ]
  },
  plugins: [
    new htmlWebpackPlugin({
      template: utils.resolve('../src/index.html'),
      filename: 'index.html',
      inject: true,
      minify: {
        removeComments: process.env.NODE_ENV === 'production',
        collapseWhitespace: process.env.NODE_ENV === 'production',
        removeAttributeQuotes: process.env.NODE_ENV === 'production'
        // more options:
        // https://github.com/kangax/html-minifier#options-quick-reference
      },
      vendor: manifest.name + '.js'
    }),
    new webpack.DllReferencePlugin({
      context: utils.resolve("../src"),
      name: 'vendor',
      manifest
    }),
    new svgSpritePlugin()    
  ],
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      '@': utils.resolve("../src"),
      'vue$': 'vue/dist/vue.esm.js'
    }
  }
};

这是我的配置

airyland commented 6 years ago

太多业务相关的,无法直接重现,建一个 repo 吧。