How to use vue-loader - 10 common examples

To help you get started, we’ve selected a few vue-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LinusBorg / vue-cli-plugin-test-attrs / index.js View on Github external
function genVueLoaderCacheConfig() {
    return api.genCacheConfig('vue-loader', {
      'vue-loader': require('vue-loader/package.json').version,
      /* eslint-disable-next-line node/no-extraneous-require */
      '@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json')
        .version,
      'vue-template-compiler': require('vue-template-compiler/package.json')
        .version,
      testAttrsOptions: JSON.stringify(options),
    })
  }
}
github nuxt / vue-meta / test / utils / build.js View on Github external
node: {
      __dirname: true
    },
    optimization: {
      splitChunks: {
        cacheGroups: {
          vendor: {
            test: /[\\/]node_modules[\\/]/,
            name: 'vendor',
            chunks: 'all'
          }
        }
      }
    },
    plugins: [
      new VueLoaderPlugin(),
      new webpack.DefinePlugin({
        'process.env': {
          // make sure our simple polyfills are enabled
          'NODE_ENV': '"test"'
        }
      }),
      new CopyWebpackPlugin([
        { from: path.join(path.dirname(config.entry), 'static') }
      ])
    ],
    resolve: {
      alias: {
        'vue': 'vue/dist/vue.esm.js',
        'vue-meta': getVueMetaPath(true)
      }
    },
github vuejs / vue-cli / packages / @vue / cli-service / lib / config / base.js View on Github external
)

    webpackConfig.resolveLoader
      .modules
        .add('node_modules')
        .add(api.resolve('node_modules'))
        .add(resolveLocal('node_modules'))

    webpackConfig.module
      .noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)

    // js is handled by cli-plugin-babel ---------------------------------------

    // vue-loader --------------------------------------------------------------
    const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', {
      'vue-loader': require('vue-loader/package.json').version,
      /* eslint-disable-next-line node/no-extraneous-require */
      '@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json').version,
      'vue-template-compiler': require('vue-template-compiler/package.json').version
    })

    webpackConfig.module
      .rule('vue')
        .test(/\.vue$/)
        .use('cache-loader')
          .loader(require.resolve('cache-loader'))
          .options(vueLoaderCacheConfig)
          .end()
        .use('vue-loader')
          .loader(require.resolve('vue-loader'))
          .options(Object.assign({
            compilerOptions: {
github dcloudio / uni-app / packages / vue-cli-plugin-uni-optimize / packages / vue-loader / index.js View on Github external
${isServer ? JSON.stringify(hash(request)) : `null`}
  ${isShadow ? `,true` : ``}
)
  `.trim() + `\n`

  if (descriptor.customBlocks && descriptor.customBlocks.length) {
    code += genCustomBlocksCode(
      descriptor.customBlocks,
      resourcePath,
      resourceQuery,
      stringifyRequest
    )
  }

  if (needsHotReload) {
    code += `\n` + genHotReloadCode(id, hasFunctional, templateRequest)
  }

  // Expose filename. This is used by the devtools and Vue runtime warnings.
  if (!isProduction) {
    // Expose the file's full path in development, so that it can be opened
    // from the devtools.
    code += `\ncomponent.options.__file = ${JSON.stringify(rawShortFilePath.replace(/\\/g, '/'))}`
  } else if (options.exposeFilename) {
    // Libraies can opt-in to expose their components' filenames in production builds.
    // For security reasons, only expose the file's basename in production.
    code += `\ncomponent.options.__file = ${JSON.stringify(filename)}`
  }

  code += `\nexport default component.exports`
  // console.log(code)
  return code
github lukeed / pwa / packages / preset-vue / index.js View on Github external
});

	// replace "style-loader" w/ "vue-style-loader"
	config.module.rules.forEach(obj => {
		if (Array.isArray(obj.use)) {
			obj.use = obj.use.map(x => x === 'style-loader' ? 'vue-style-loader' : x);
		}
	});

	config.module.rules.unshift({
		test: /\.vue$/,
		loader: 'vue-loader'
	});

	config.plugins.push(
		new VueLoaderPlugin({
			productionMode: opts.production
		})
	);
}
github viky-ai / viky-ai / webapp / config / webpack / environment.js View on Github external
const { environment } = require('@rails/webpacker')
const coffee =  require('./loaders/coffee')
const { VueLoaderPlugin } = require('vue-loader')
const vue = require('./loaders/vue')

// resolve-url-loader must be used before sass-loader
environment.loaders.get('sass').use.splice(-1, 0, {
  loader: 'resolve-url-loader'
});

environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
environment.loaders.prepend('coffee', coffee)
module.exports = environment
github kaishuu0123 / rebacklogs / config / webpack / environment.js View on Github external
//             name: 'vendor-commons',
//             chunks: 'initial'
//           }
//         }
//       }
//     }
//   })
// })

environment.plugins.append('Provide', new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  Popper: ['popper.js', 'default']
}))

environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
environment.plugins.append('ContextReplacement',
  new webpack.ContextReplacementPlugin(
    /moment[\/\\]locale$/,
    /ja|en-SG|en-au|en-ca|en-gb|en-ie|en-il|en-nz|de|fr|fu|zh-tw|zh-cn|zh-hk/
  )
)

module.exports = environment
github geekape / applet-h5-shop / mpvue / weiapp / dist / pages / shop / confirm_order / main.js View on Github external
}, [_c('van-radio', {
      attrs: {
        "name": shopIdx,
        "mpcomid": '14-' + shopIdx
      }
    })], 1)
  }))], 1)], 1)], 2)
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
  module.hot.accept()
  if (module.hot.data) {
     require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-a5d44e4c", esExports)
  }
}

/***/ })
github geekape / applet-h5-shop / mpvue / weiapp / dist / pages / shop / add_address / main.js View on Github external
}
  }, [_vm._v("保存")]), _vm._v(" "), _c('van-toast', {
    attrs: {
      "id": "van-toast",
      "mpcomid": '1'
    }
  })], 1)
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
  module.hot.accept()
  if (module.hot.data) {
     require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-31071161", esExports)
  }
}

/***/ })
github geekape / applet-h5-shop / mpvue / weiapp / dist / pages / shop / my_comment / main.js View on Github external
staticClass: "u-goods__tt overflow-dot_row"
    }, [_vm._v(_vm._s(item.goods_title))]), _vm._v(" "), _c('div', {
      staticClass: "goods-line__ft"
    }, [_c('div', {
      staticClass: "goods-line__price"
    }, [_c('span', [_vm._v("¥" + _vm._s(item.sale_price))])])])], 1)])])])
  }))
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
  module.hot.accept()
  if (module.hot.data) {
     require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-01f2cd77", esExports)
  }
}

/***/ })