How to use the @dcloudio/uni-cli-shared.getPlatformCompiler function in @dcloudio/uni-cli-shared

To help you get started, we’ve selected a few @dcloudio/uni-cli-shared 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 dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / h5 / index.js View on Github external
// Vue
    webpackConfig.module
      .rule('vue')
      .test([/\.vue$/, /\.nvue$/])
      .use('vue-loader')
      .tap(options => Object.assign(options, {
        compiler: getPlatformCompiler(),
        compilerOptions: require('./compiler-options'),
        cacheDirectory: false,
        cacheIdentifier: false
      }))
      .end()
      .use('uniapp-custom-block-loader')
      .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
      .options({
        compiler: getPlatformCompiler()
      })
      .end()
      .use('uniapp-scoped')
      .loader(resolve('packages/webpack-scoped-loader'))
      .end()
      .uses
      .delete('cache-loader')

    if (process.env.NODE_ENV === 'production') {
      const module = webpackConfig.module
      // TODO 临时 hack calc:false 看看 vue cli 后续是否开放 cssnano 的配置
      const cssnanoOptions = {
        sourceMap: false,
        plugins: [require('cssnano')({
          preset: ['default', getPlatformCssnano()]
        })]
github dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / vue-loader.js View on Github external
webpackConfig.module
    .rule('vue')
    .test([/\.vue$/, /\.nvue$/])
    .use('vue-loader')
    .tap(options => Object.assign(options, {
      compiler: getPlatformCompiler(),
      compilerOptions: Object.assign({
        isUnaryTag,
        preserveWhitespace: false
      }, compilerOptions)
    }, cacheConfig))
    .end()
    .use('uniapp-custom-block-loader')
    .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
    .options({
      compiler: getPlatformCompiler()
    })

  // h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式
  if (process.env.UNI_PLATFORM === 'h5') {
    webpackConfig.module
      .rule('vue')
      .use('uniapp-h5-style-scoped')
      .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader'))
  } else {
    webpackConfig.module
      .rule('vue')
      .use('uniapp-nvue-style-loader')
      .loader(require.resolve('@dcloudio/webpack-uni-mp-loader/lib/style.js'))
  }
  // 是否启用 cache
  if (process.env.UNI_USING_CACHE) {
github dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / mp.js View on Github external
.tap(options => Object.assign(options, {
        compiler: getPlatformCompiler(),
        compilerOptions: process.env.UNI_USING_COMPONENTS ? {
          isUnaryTag,
          preserveWhitespace: false
        } : require('./mp-compiler-options'),
        cacheDirectory: false,
        cacheIdentifier: false
      }))
      .end()
github dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / vue-loader.js View on Github external
.tap(options => Object.assign(options, {
      compiler: getPlatformCompiler(),
      compilerOptions: Object.assign({
        isUnaryTag,
        preserveWhitespace: false
      }, compilerOptions)
    }, cacheConfig))
    .end()