How to use the @dcloudio/uni-cli-shared.getMainEntry 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 / mp.js View on Github external
globalObject: process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'global',
        sourceMapFilename: '../.sourcemap/' + process.env.UNI_PLATFORM + '/[name].js.map'
      },
      performance: {
        hints: false
      },
      resolve: {
        extensions: ['.nvue'],
        alias: { // 仅 mp-weixin
          'mpvue-page-factory': require.resolve(
            '@dcloudio/vue-cli-plugin-uni/packages/mpvue-page-factory')
        }
      },
      module: {
        rules: [{
          test: path.resolve(process.env.UNI_INPUT_DIR, getMainEntry()),
          use: [{
            loader: '@dcloudio/webpack-uni-mp-loader/lib/main'
          }]
        }, {
          resourceQuery: /vue&type=script/,
          use: [{
            loader: '@dcloudio/webpack-uni-mp-loader/lib/script'
          }]
        }, {
          resourceQuery: /vue&type=template/,
          use: [{
            loader: '@dcloudio/webpack-uni-mp-loader/lib/template'
          }]
        }, {
          resourceQuery: [
            /lang=wxs/,
github dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / h5 / index.js View on Github external
plugins.push(new WebpackHtmlAppendPlugin(
    `
        
        `
  ))
}

const vueConfig = {
  parallel: false, // 因为传入了自定义 compiler,避免参数丢失,禁用parallel
  publicPath,
  pages: {
    index: {
      // page 的入口
      entry: path.resolve(process.env.UNI_INPUT_DIR, getMainEntry()),
      // 模板来源
      template,
      // 在 dist/index.html 的输出
      filename: 'index.html',
      // 当使用 title 选项时,
      // template 中的 title 标签需要是 <title>&lt;%= htmlWebpackPlugin.options.title %&gt;</title>
      title,
      // 在这个页面中包含的块,默认情况下会包含
      // 提取出来的通用 chunk 和 vendor chunk。
      chunks: ['chunk-vendors', 'chunk-common', 'index'],
      baseUrl: publicPath
    }
  }
}

if (devServer &amp;&amp; Object.keys(devServer).length) {
github dcloudio / uni-app / packages / vue-cli-plugin-uni / lib / configure-webpack.js View on Github external
`import 'uni-pages';import 'uni-${process.env.UNI_PLATFORM}';`
    } else {
      beforeCode = `import 'uni-pages';`
    }

    const rules = [{
      test: path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
      use: [{
        loader: 'babel-loader'
      }, {
        loader: '@dcloudio/webpack-uni-pages-loader'
      }],
      type: 'javascript/auto'
    },
    {
      test: path.resolve(process.env.UNI_INPUT_DIR, getMainEntry()),
      // resourceQuery: /type=wrapper/,
      use: [{
        loader: 'wrap-loader',
        options: {
          before: [
            beforeCode + statCode
          ]
        }
      }]
    },
    {
      resourceQuery: /vue&type=template/,
      use: [{
        loader: resolve('packages/webpack-preprocess-loader'),
        options: htmlPreprocessOptions
      }]