diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 78f5d35163..9b70e463c1 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -25,9 +25,7 @@ jobs:
node_modules
test/e2e/miniprogram-project/node_modules
test/e2e/plugin-project/node_modules
- packages/webpack-plugin/node_modules
- packages/core/node_modules
- packages/api-proxy/node_modules
+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
@@ -36,7 +34,7 @@ jobs:
- name: install deps
if: steps.cache.outputs.cache-hit != 'true'
- run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci
+ run: npm i && npm i --prefix test/e2e/miniprogram-project && npm i --prefix test/e2e/plugin-project && npx lerna bootstrap --no-ci
- name: copy-webpack-plugin
run: npm run copyPlugin --prefix test/e2e/miniprogram-project && npm run copyPlugin --prefix test/e2e/plugin-project
diff --git a/test/e2e/copyWebpackPlugin.sh b/test/e2e/copyWebpackPlugin.sh
new file mode 100644
index 0000000000..ed61570eb1
--- /dev/null
+++ b/test/e2e/copyWebpackPlugin.sh
@@ -0,0 +1,7 @@
+echo "start copy webpackPlugin"
+
+cp -r ../../../packages/* ./node_modules/@mpxjs/
+
+rm -rf ./node_modules/@mpxjs/webpack-plugin/node_modules/webpack
+
+echo "end copy webpackPlugin"
diff --git a/test/e2e/miniprogram-project/copyWebpackPlugin.sh b/test/e2e/miniprogram-project/copyWebpackPlugin.sh
deleted file mode 100644
index 46ca1928b4..0000000000
--- a/test/e2e/miniprogram-project/copyWebpackPlugin.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-echo "start copy webpackPlugin"
-
-rm -rf ./node_modules/@mpxjs/webpack-plugin/lib
-
-scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/
-
-echo "end copy webpackPlugin"
diff --git a/test/e2e/miniprogram-project/package.json b/test/e2e/miniprogram-project/package.json
index 2bb89f67b6..0ef9161bea 100644
--- a/test/e2e/miniprogram-project/package.json
+++ b/test/e2e/miniprogram-project/package.json
@@ -10,7 +10,7 @@
"build:dev": "node ./build/build.js",
"watch:cross": "npm run watch --modes=wx,ali,web",
"build:cross": "npm run build --modes=wx,ali,tt,swan",
- "copyPlugin": "sh ./copyWebpackPlugin.sh",
+ "copyPlugin": "sh ../copyWebpackPlugin.sh",
"watch:web:serve": "npx npm-run-all --parallel watch:web serve",
"watch:web": "npm run watch --mode=web",
"serve": "npx http-server dist/web",
@@ -25,6 +25,7 @@
"dependencies": {
"@mpxjs/api-proxy": "^2.7.1",
"@mpxjs/core": "^2.9.1",
+ "@mpxjs/store": "^2.9.9",
"@mpxjs/utils": "^2.9.1",
"semver": "^7.5.4",
"vue": "^2.6.10",
@@ -39,11 +40,13 @@
"@babel/plugin-transform-runtime": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@babel/runtime-corejs3": "^7.10.4",
+ "@mpxjs/babel-plugin-inject-page-events": "^2.8.0",
"@mpxjs/miniprogram-simulate": "1.4.9",
"@mpxjs/mpx-jest": "0.0.27",
- "@mpxjs/webpack-plugin": "^2.7.2",
+ "@mpxjs/webpack-plugin": "^2.9.21",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
+ "async": "^3.2.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^25.3.0",
"babel-loader": "^8.1.0",
@@ -82,7 +85,7 @@
"vue-router": "^3.1.3",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.10",
- "webpack": "^5.48.0",
+ "webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-merge": "^5.8.0"
diff --git a/test/e2e/miniprogram-wxss-loader/.editorconfig b/test/e2e/miniprogram-wxss-loader/.editorconfig
deleted file mode 100644
index 9d08a1a828..0000000000
--- a/test/e2e/miniprogram-wxss-loader/.editorconfig
+++ /dev/null
@@ -1,9 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-indent_style = space
-indent_size = 2
-end_of_line = lf
-insert_final_newline = true
-trim_trailing_whitespace = true
diff --git a/test/e2e/miniprogram-wxss-loader/.gitignore b/test/e2e/miniprogram-wxss-loader/.gitignore
deleted file mode 100644
index 3c0fb7969d..0000000000
--- a/test/e2e/miniprogram-wxss-loader/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.DS_Store
-node_modules/
-npm-debug.log
-.idea/
-deploy/
-output/
-dist/
-.vscode/
diff --git a/test/e2e/miniprogram-wxss-loader/README.md b/test/e2e/miniprogram-wxss-loader/README.md
deleted file mode 100644
index 83dfa352d6..0000000000
--- a/test/e2e/miniprogram-wxss-loader/README.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# mpx-feature-unit-test
-
-> mpx feature unit test
-
-## Dev
-
-```bash
-# install dep
-npm i
-
-# for dev
-npm run watch
-
-# for online
-npm run build
-```
-
-npm script 规范 [build|watch]:[dev|prod]:[cross|web|none]
-
-build 默认 prod,watch 默认 dev。另单独提供了 build:dev 和 watch:prod,用于单次构建分析看未压缩代码分析问题和持续压缩代码便于大体积项目真机调试。
-
-建议自行调整 cross 的目标。npm-run-all 是为了兼容 windows 下无法同时执行两个 npm script,若不需要转 web 平台,可考虑去掉。
-
-## 样式复用使用说明:
-
-1. 要想通过样式预处理器跳过对 .less、.sass、.styl(us) 文件的处理,可以使用例如 `/*preCompileIgnore @import 'xx.less';*/` 语法跳过文件的预编译处理,会在最终的 wxss-loader 中进行处理。用法如下:
-
-```CSS
-
-```
-
-```JS
-// webpack配置以下less解析规则:
-
-{
-test: /\.less$/,
-use: [
- MpxWebpackPlugin.wxssLoader({
- importLoaders: 1 // The option importLoaders allows you to configure how many loaders before wxss-loader should be applied to @imported resources and CSS modules/ICSS imports.
- }),
- 'less-loader'
-]
-}
-
-// 以上配置表示 global.less 文件在 wxss-loader 处理之前会先经过 less-loader 的处理再被 wxss-loader 处理。
-
-// 例如:
-{
-test: /\.less$/,
-use: [
- MpxWebpackPlugin.wxssLoader({
- importLoaders: 2 // The option importLoaders allows you to configure how many loaders before wxss-loader should be applied to @imported resources and CSS modules/ICSS imports.
- }),
- 'postcss-loader',
- 'less-loader'
-]
-}
-
-// 以上配置表示 global.less 文件在 wxss-loader 处理之前会先经过 less-loader 、postcss-loader 的处理再被 wxss-loader 处理。
-
-
-```
-
-
-通过以上的配置,最终会将导入的 global.less 文件分离成单独一个文件。
\ No newline at end of file
diff --git a/test/e2e/miniprogram-wxss-loader/babel.config.json b/test/e2e/miniprogram-wxss-loader/babel.config.json
deleted file mode 100644
index 58b76917fa..0000000000
--- a/test/e2e/miniprogram-wxss-loader/babel.config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "presets": [
- [
- "@babel/env",
- {
- "modules": false,
- "shippedProposals": true
- }
- ]
- ],
- "plugins": [
- [
- "@babel/transform-runtime",
- {
- "corejs": 3,
- "version": "^7.10.4"
- }
- ]
- ],
- "sourceType": "unambiguous",
- "env": {
- "test": {
- "presets": [
- [
- "@babel/env",
- {
- "shippedProposals": true
- }
- ]
- ]
- }
- }
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/build.js b/test/e2e/miniprogram-wxss-loader/build/build.js
deleted file mode 100644
index 1c2f278d98..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/build.js
+++ /dev/null
@@ -1,142 +0,0 @@
-const rm = require('rimraf')
-const chalk = require('chalk')
-const webpack = require('webpack')
-const program = require('commander')
-const { userConf, supportedModes } = require('../config/index')
-const getWebpackConf = require('./getWebpackConf')
-const { resolveDist, getRootPath } = require('./utils')
-program
- .option('-w, --watch', 'watch mode')
- .option('-p, --production', 'production release')
- .parse(process.argv)
-
-const env = process.env
-
-const modeStr = env.npm_config_mode || env.npm_config_modes || ''
-
-const report = env.npm_config_report
-
-const modes = modeStr.split(/[,|]/)
- .map((mode) => {
- const modeArr = mode.split(':')
- if (supportedModes.includes(modeArr[0])) {
- return {
- mode: modeArr[0],
- env: modeArr[1]
- }
- }
- }).filter((item) => item)
-
-if (!modes.length) {
- modes.push({
- mode: userConf.srcMode
- })
-}
-
-// 开启子进程
-if (userConf.openChildProcess && modes.length > 1) {
- let scriptType = ''
- const isProduct = program.production
- const isWatch = program.watch
- if (!isProduct && isWatch) scriptType = 'watch'
- if (isProduct && !isWatch) scriptType = 'build'
- if (isProduct && isWatch) scriptType = 'watch:prod'
- if (!isProduct && !isWatch) scriptType = 'build:dev'
-
- const spawn = require('child_process').spawn
- while (modes.length > 1) {
- const modeObj = modes.pop()
- const modeAndEnv = modeObj.env ? `${modeObj.mode}:${modeObj.env}` : modeObj.mode
- const ls = spawn('npm', ['run', scriptType, `--modes=${modeAndEnv}`, `--mode=${modeAndEnv}`], { stdio: 'inherit' })
- ls.on('close', (code) => {
- process.exitCode = code
- })
- }
-}
-
-let webpackConfs = []
-
-modes.forEach(({ mode, env }) => {
- const options = Object.assign({}, userConf, {
- mode,
- env,
- production: program.production,
- watch: program.watch,
- report,
- subDir: (userConf.isPlugin || userConf.cloudFunc) ? 'miniprogram' : ''
- })
- webpackConfs.push(getWebpackConf(options))
-})
-
-if (userConf.isPlugin) {
- // 目前支持的plugin构建平台
- modes.filter(({ mode }) => ['wx', 'ali'].includes(mode)).forEach(({ mode, env }) => {
- const options = Object.assign({}, userConf, {
- plugin: true,
- mode,
- env,
- production: program.production,
- watch: program.watch,
- report,
- subDir: 'plugin'
- })
- webpackConfs.push(getWebpackConf(options))
- })
-}
-
-if (webpackConfs.length === 1) {
- webpackConfs = webpackConfs[0]
-}
-
-
-try {
- modes.forEach(({ mode, env }) => {
- rm.sync(resolveDist(getRootPath(mode, env), '*'))
- })
-} catch (e) {
- console.error(e)
- console.log('\n\n删除dist文件夹遇到了一些问题,如果遇到问题请手工删除dist重来\n\n')
-}
-
-if (program.watch) {
- webpack(webpackConfs).watch(undefined, callback)
-} else {
- webpack(webpackConfs, callback)
-}
-
-function callback (err, stats) {
- if (err) {
- process.exitCode = 1
- return console.error(err)
- }
- if (Array.isArray(stats.stats)) {
- stats.stats.forEach(item => {
- console.log(item.compilation.name + '打包结果:')
- process.stdout.write(item.toString({
- colors: true,
- modules: false,
- children: false,
- chunks: false,
- chunkModules: false,
- entrypoints: false
- }) + '\n\n')
- })
- } else {
- process.stdout.write(stats.toString({
- colors: true,
- modules: false,
- children: false,
- chunks: false,
- chunkModules: false,
- entrypoints: false
- }) + '\n\n')
- }
-
- if (stats.hasErrors()) {
- console.log(chalk.red(' Build failed with errors.\n'))
- } else if (program.watch) {
- console.log(chalk.cyan(` Build complete at ${new Date()}.\n Still watching...\n`))
- } else {
- console.log(chalk.cyan(' Build complete.\n'))
- }
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/getPlugins.js b/test/e2e/miniprogram-wxss-loader/build/getPlugins.js
deleted file mode 100644
index 52994327ea..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/getPlugins.js
+++ /dev/null
@@ -1,106 +0,0 @@
-let { mpxPluginConf, dllConf, supportedModes } = require('../config/index')
-const MpxWebpackPlugin = require('@mpxjs/webpack-plugin')
-const { resolve, resolveSrc, getConf } = require('./utils')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const CopyWebpackPlugin = require('copy-webpack-plugin')
-const ESLintPlugin = require('eslint-webpack-plugin')
-const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
-const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin
-const webpack = require('webpack')
-const path = require('path')
-
-module.exports = function getPlugins (options) {
- const { mode, srcMode, env, subDir, production, report, cloudFunc, needDll, needEslint } = options
- const plugins = []
- const copyIgnoreArr = supportedModes.map((item) => {
- return `**/${item}/**`
- })
-
- const currentMpxPluginConf = getConf(mpxPluginConf, options)
-
- plugins.push(new MpxWebpackPlugin(Object.assign({}, currentMpxPluginConf, {
- mode,
- srcMode
- }, env && { env })))
-
- const copyList = [
- {
- context: resolve(`static/${mode}`),
- from: '**/*',
- to: subDir ? '..' : '',
- noErrorOnMissing: true
- },
- {
- context: resolve('static'),
- from: '**/*',
- to: subDir ? '..' : '',
- globOptions: {
- ignore: copyIgnoreArr
- },
- noErrorOnMissing: true
- }
- ]
-
- if (cloudFunc) {
- copyList.push({
- context: resolve('src/functions'),
- from: '**/*',
- to: '../functions/'
- })
- }
-
- if (needDll) {
- const getDllManifests = require('./getDllManifests')
- const dllManifests = getDllManifests(production)
- const localDllManifests = dllManifests.filter((manifest) => {
- return manifest.mode === mode || !manifest.mode
- })
-
- localDllManifests.forEach((manifest) => {
- plugins.push(new webpack.DllReferencePlugin({
- context: dllConf.context,
- manifest: manifest.content
- }))
- copyList.push({
- context: path.join(dllConf.path, 'lib'),
- from: manifest.content.name,
- to: manifest.content.name
- })
- })
- }
-
- if (needEslint) {
- plugins.push(new ESLintPlugin({
- context: resolve(),
- exclude: [resolve('node_modules')],
- extensions: ['js', 'ts', 'mpx']
- }))
- }
-
- plugins.push(new CopyWebpackPlugin({
- patterns: copyList
- }))
-
- plugins.push(new webpack.DefinePlugin({
- 'process.env': {
- NODE_ENV: production ? '"production"' : '"development"'
- }
- }))
-
- if (mode === 'web') {
- plugins.push(new VueLoaderPlugin())
- plugins.push(new HtmlWebpackPlugin({
- filename: 'index.html',
- template: resolveSrc('index.html', subDir),
- inject: true
- }))
- }
-
- plugins.push(new webpack.ProgressPlugin())
-
- if (report) {
- plugins.push(new BundleAnalyzerPlugin())
- }
-
- return plugins
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/getRules.js b/test/e2e/miniprogram-wxss-loader/build/getRules.js
deleted file mode 100644
index 7bc57e42ba..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/getRules.js
+++ /dev/null
@@ -1,132 +0,0 @@
-let { mpxLoaderConf } = require('../config/index')
-const MpxWebpackPlugin = require('@mpxjs/webpack-plugin')
-const { resolve, getConf } = require('./utils')
-
-const baseRules = [
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: [resolve('src'), resolve('test'), resolve('node_modules/@mpxjs')]
- },
- {
- test: /\.json$/,
- resourceQuery: /asScript/,
- type: 'javascript/auto'
- },
- {
- test: /\.(wxs|qs|sjs|qjs|jds|dds|filter\.js)$/,
- use: [
- MpxWebpackPlugin.wxsPreLoader()
- ],
- enforce: 'pre'
- },
- {
- test: /\.(png|jpe?g|gif|svg)$/,
- use: [
- MpxWebpackPlugin.urlLoader({
- name: 'img/[name][hash].[ext]'
- })
- ]
- }
-]
-
-const tsRule = {
- test: /\.ts$/,
- use: [
- 'babel-loader',
- {
- loader: 'ts-loader',
- options: {
- appendTsSuffixTo: [/\.(mpx|vue)$/]
- }
- }
- ]
-}
-
-module.exports = function getRules (options) {
- const { mode, tsSupport } = options
-
- let rules = baseRules.slice()
-
- if (tsSupport) {
- rules.push(tsRule)
- }
-
- const currentMpxLoaderConf = getConf(mpxLoaderConf, options)
-
- if (mode === 'web') {
- rules = rules.concat([
- {
- test: /\.mpx$/,
- use: [
- {
- loader: 'vue-loader',
- options: {
- transformToRequire: {
- 'mpx-image': 'src',
- 'mpx-audio': 'src',
- 'mpx-video': 'src'
- }
- }
- },
- MpxWebpackPlugin.loader(currentMpxLoaderConf)
- ]
- },
- {
- test: /\.vue$/,
- loader: 'vue-loader'
- },
- // 如输出web时需要支持其他预编译语言,可以在此添加rule配置
- {
- test: /\.styl(us)?$/,
- use: [
- 'vue-style-loader',
- 'css-loader',
- 'stylus-loader'
- ]
- },
- {
- test: /\.css$/,
- use: [
- 'vue-style-loader',
- 'css-loader'
- ]
- }
- ])
- } else {
- rules = rules.concat([
- {
- test: /\.mpx$/,
- use: MpxWebpackPlugin.loader(currentMpxLoaderConf)
- },
- {
- test: /\.styl(us)?$/,
- use: [
- MpxWebpackPlugin.wxssLoader(),
- 'stylus-loader'
- ]
- },
- {
- test: /\.less$/,
- use: [
- MpxWebpackPlugin.wxssLoader({
- importLoaders: 1
- }),
- 'less-loader'
- ]
- },
- {
- test: /\.(wxss|acss|css|qss|ttss|jxss|ddss)$/,
- use: MpxWebpackPlugin.wxssLoader()
- },
- {
- test: /\.(wxml|axml|swan|qml|ttml|qxml|jxml|ddml)$/,
- use: [
- 'html-loader'
- ]
- }
- ])
- }
-
- return rules
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js b/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js
deleted file mode 100644
index 3ef9698bf8..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/getWebpackConf.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const webpackBaseConf = require('./webpack.base.conf')
-const { mergeWithCustomize, customizeObject } = require('webpack-merge')
-const getRules = require('./getRules')
-const getPlugins = require('./getPlugins')
-const { resolveSrc, resolveDist, getRootPath } = require('./utils')
-
-module.exports = function getWebpackConfs (options) {
- const { plugin, subDir, mode, env, production, watch } = options
- const entry = plugin ? {
- plugin: resolveSrc('plugin.json?mpx&type=json&extract&isPlugin&asScript', subDir)
- } : {
- app: resolveSrc('app.mpx', subDir)
- }
- const rootPath = getRootPath(mode, env)
- const output = {
- path: resolveDist(rootPath, subDir),
- publicPath: '/',
- filename: '[name].js'
- }
- const name = plugin ? `${rootPath}-plugin-compiler` : `${rootPath}-compiler`
- const rules = getRules(options)
- const plugins = getPlugins(options)
- const extendConfs = {}
- if (production) {
- extendConfs.mode = 'production'
- }
- extendConfs.optimization = {
- nodeEnv: production ? 'production' : 'development'
- }
- if (watch) {
- // 仅在watch模式下生产sourcemap
- // 百度小程序不开启sourcemap,开启会有模板渲染问题
- if (mode !== 'swan') {
- extendConfs.devtool = 'source-map'
- }
- }
-
- return mergeWithCustomize({
- customizeObject: customizeObject({
- snapshot: 'replace'
- })
- })(webpackBaseConf, {
- name,
- entry,
- output,
- module: {
- rules
- },
- plugins
- }, extendConfs)
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/package.json b/test/e2e/miniprogram-wxss-loader/build/package.json
deleted file mode 100644
index a84ff3ca30..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "build",
- "version": "1.0.0",
- "description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/utils.js b/test/e2e/miniprogram-wxss-loader/build/utils.js
deleted file mode 100644
index 5334f26415..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/utils.js
+++ /dev/null
@@ -1,39 +0,0 @@
-const path = require('path')
-
-function resolveSrc (file, subDir = '') {
- return path.join(__dirname, '../src', subDir, file || '')
-}
-
-function resolveDist (platform, subDir = '') {
- return path.join(__dirname, '../dist', platform, subDir)
-}
-
-function resolve (file) {
- return path.join(__dirname, '..', file || '')
-}
-
-function normalizeArr (arrCfg) {
- if (Array.isArray(arrCfg) && arrCfg.length) {
- return arrCfg
- } else if (arrCfg) {
- return [arrCfg]
- }
- return []
-}
-
-function getRootPath (...args) {
- return args.filter(item => item).join('_')
-}
-
-function getConf (conf, options) {
- return typeof conf === 'function' ? conf(options) : conf
-}
-
-module.exports = {
- resolve,
- resolveSrc,
- resolveDist,
- normalizeArr,
- getRootPath,
- getConf
-}
diff --git a/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js b/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js
deleted file mode 100644
index d653ac678a..0000000000
--- a/test/e2e/miniprogram-wxss-loader/build/webpack.base.conf.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const { resolve } = require('./utils')
-
-module.exports = {
- performance: {
- hints: false
- },
- mode: 'none',
- resolve: {
- extensions: ['.mpx', '.js', '.wxml', '.vue', '.ts'],
- modules: ['node_modules']
- },
- cache: {
- type: 'filesystem',
- buildDependencies: {
- build: [resolve('build/')],
- config: [resolve('config/')]
- },
- cacheDirectory: resolve('.cache/')
- },
- snapshot: {
- // 如果希望修改node_modules下的文件时对应的缓存可以失效,可以将此处的配置改为 managedPaths: []
- managedPaths: [resolve('node_modules/')]
- },
- optimization: {
- minimizer: [
- {
- apply: compiler => {
- // Lazy load the Terser plugin
- const TerserPlugin = require('terser-webpack-plugin')
- new TerserPlugin({
- // terserOptions参考 https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
- terserOptions: {
- // terser的默认行为会把某些对象方法转为箭头函数,导致ios9等不支持箭头函数的环境白屏,详情见 https://github.com/terser/terser#compress-options
- compress: {
- arrows: false
- }
- }
- }).apply(compiler)
- }
- }
- ]
- }
-}
diff --git a/test/e2e/miniprogram-wxss-loader/config/index.js b/test/e2e/miniprogram-wxss-loader/config/index.js
deleted file mode 100644
index 9f84ab52c3..0000000000
--- a/test/e2e/miniprogram-wxss-loader/config/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const mpxLoaderConf = require('./mpxLoader.conf')
-const mpxPluginConf = require('./mpxPlugin.conf')
-const userConf = require('./user.conf')
-
-const supportedModes = ['wx', 'ali', 'swan', 'qq', 'tt', 'qa', 'jd', 'dd']
-
-if (userConf.transWeb) {
- supportedModes.push('web')
-}
-
-const options = {
- userConf,
- mpxLoaderConf,
- mpxPluginConf,
- supportedModes
-}
-
-if (userConf.needDll) {
- options.dllConf = require('./dll.conf')
-}
-
-module.exports = options
diff --git a/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js b/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js
deleted file mode 100644
index 36bbfe2cf2..0000000000
--- a/test/e2e/miniprogram-wxss-loader/config/mpxLoader.conf.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// mpx的loader配置在这里传入
-// 配置项文档:https://www.mpxjs.cn/api/compile.html#mpxwebpackplugin-loader
-module.exports = {}
diff --git a/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js b/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js
deleted file mode 100644
index 7db0cbf9cc..0000000000
--- a/test/e2e/miniprogram-wxss-loader/config/mpxPlugin.conf.js
+++ /dev/null
@@ -1,94 +0,0 @@
-const resolve = require('../build/utils').resolve
-const path = require('path')
-
-// 可以在此配置mpx webpack plugin
-// 配置项文档: https://www.mpxjs.cn/api/compile.html#mpxwebpackplugin-options
-module.exports = {
- // resolve的模式
- resolveMode: 'webpack', // 可选值 webpack / native,默认是webpack,原生迁移建议使用native
-
- // 当resolveMode为native时可通过该字段指定项目根目录
- // projectRoot: resolve('src'),
-
- // 可选值 full / changed,不传默认为change,当设置为changed时在watch模式下将只会对内容发生变化的文件进行写入,以提升小程序开发者工具编译性能
- writeMode: 'changed',
-
- env: 'someEnv',
-
- // 是否需要对样式加scope,因为只有ali平台没有样式隔离,只对ali平台生效,提供include和exclude,和webpack的rules规则相同
- // autoScopeRules: {
- // include: [resolve('src')]
- // },
-
- // 批量指定文件mode,用法如下,指定平台,提供include/exclude指定文件,即include的文件会默认被认为是该平台的,include/exclude的规则和webpack的rules的相同
- modeRules: {
- // ali: {
- // include: [resolve('node_modules/vant-aliapp')]
- // }
- },
-
- // 定义一些全局环境变量,可在JS/模板/样式/JSON中使用
- defs: {
- __black__: 'blackgan test'
- },
-
- // 是否转换px到rpx
- transRpxRules: [
- {
- mode: 'all',
- comment: 'use rpx',
- designWidth: 1280,
- include: resolve('src')
- }
- ],
-
- decodeHTMLText: true,
-
- transMpxRules: {
- include: () => true,
- exclude: ['@mpxjs']
- },
-
- autoScopeRules: {
- include: [resolve('src')]
- },
-
- generateBuildMap: true,
-
- // 输出web时,vue-loader版本<15时需要将该配置关闭
- forceDisableBuiltInLoader: true,
-
- subpackageModulesRules: {
- include: [/utils\/common/]
- },
-
- // 多语言i18n能力 以下是简单示例,更多详情请参考文档:https://didi.github.io/mpx/i18n.html
- i18n: {
- locale: 'en-US',
- // messages既可以通过对象字面量传入,也可以通过messagesPath指定一个js模块路径,在该模块中定义配置并导出,dateTimeFormats/dateTimeFormatsPath和numberFormats/numberFormatsPath同理
- messages: {
- 'en-US': {
- message: {
- hello: '{msg} world'
- }
- },
- 'zh-CN': {
- message: {
- hello: '{msg} 世界'
- }
- }
- }
- },
- customOutputPath: (type, name, hash, ext) => {
- // type: 资源类型(page | component | static)
- // name: 资源原有文件名
- // hash: 8位长度的hash串
- // ext: 文件后缀(.js| .wxml | .json 等)
- if (name === 'customOutputCom') {
- return path.join(type + 's', name, 'index' + ext)
- }
- // 输出示例: pages/testax34dde3/index.js
- return path.join(type + 's', name + hash, 'index' + ext)
- }
-
-}
diff --git a/test/e2e/miniprogram-wxss-loader/config/package.json b/test/e2e/miniprogram-wxss-loader/config/package.json
deleted file mode 100644
index a59b4221e8..0000000000
--- a/test/e2e/miniprogram-wxss-loader/config/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "config",
- "version": "1.0.0",
- "description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
-}
diff --git a/test/e2e/miniprogram-wxss-loader/config/user.conf.js b/test/e2e/miniprogram-wxss-loader/config/user.conf.js
deleted file mode 100644
index 154a99a940..0000000000
--- a/test/e2e/miniprogram-wxss-loader/config/user.conf.js
+++ /dev/null
@@ -1,22 +0,0 @@
-function formatOption (option) {
- if (option === 'true') return true
- if (option === 'false') return false
- return option
-}
-
-// 根据创建项目时的问题生成的
-// 改动需谨慎,有的选项存在互斥关系,比如跨平台,则无法使用云函数
-// 若需修改以启用新的能力,建议试试新建项目按问题生成模板后把这部分内容拷贝过来
-module.exports = {
- srcMode: formatOption('wx'),
- cross: formatOption('true'),
- openChildProcess: formatOption('true'),
- transWeb: formatOption('true'),
- cloudFunc: formatOption('false'),
- isPlugin: formatOption('false'),
- tsSupport: formatOption('false'),
- babel7Support: formatOption('true'),
- needEslint: formatOption('false'),
- needDll: formatOption('false'),
- needUnitTest: formatOption('false')
-}
diff --git a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh b/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh
deleted file mode 100644
index 46ca1928b4..0000000000
--- a/test/e2e/miniprogram-wxss-loader/copyWebpackPlugin.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-echo "start copy webpackPlugin"
-
-rm -rf ./node_modules/@mpxjs/webpack-plugin/lib
-
-scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/
-
-echo "end copy webpackPlugin"
diff --git a/test/e2e/miniprogram-wxss-loader/package.json b/test/e2e/miniprogram-wxss-loader/package.json
deleted file mode 100644
index 3f63814b8f..0000000000
--- a/test/e2e/miniprogram-wxss-loader/package.json
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "name": "mpx-feature-unit-test",
- "version": "1.0.0",
- "description": "mpx feature unit test",
- "main": "index.js",
- "scripts": {
- "watch": "node ./build/build.js -w",
- "watch:prod": "node ./build/build.js -w -p",
- "build": "node ./build/build.js",
- "build:wx": "npm run build --mode=wx",
- "build:ali": "npm run build --mode=ali",
- "build:dev": "node ./build/build.js",
- "watch:cross": "npm run watch --modes=wx,ali,web",
- "build:cross": "npm run build --modes=wx,ali,tt,swan",
- "copyPlugin": "sh ./copyWebpackPlugin.sh",
- "watch:web:serve": "npx npm-run-all --parallel watch:web serve",
- "watch:web": "npm run watch --mode=web",
- "serve": "npx http-server dist/web",
- "help": "node ./build/build.js --help",
- "test": "jest --no-cache"
- },
- "_moduleAliases": {
- "@mpxjs/webpack-plugin": "../../packages/webpack-plugin"
- },
- "author": "octoberluobin ",
- "license": "ISC",
- "dependencies": {
- "@mpxjs/api-proxy": "^2.7.1",
- "@mpxjs/core": "^2.9.1",
- "@mpxjs/utils": "^2.9.1",
- "semver": "^7.5.4",
- "vue": "^2.6.10",
- "vue-i18n": "^8.15.3"
- },
- "browserslist": [
- "ios >= 9",
- "chrome >= 47"
- ],
- "devDependencies": {
- "@babel/core": "^7.10.4",
- "@babel/plugin-transform-runtime": "^7.10.4",
- "@babel/preset-env": "^7.10.4",
- "@babel/runtime-corejs3": "^7.10.4",
- "@mpxjs/miniprogram-simulate": "1.4.9",
- "@mpxjs/mpx-jest": "0.0.27",
- "@mpxjs/webpack-plugin": "^2.7.55",
- "@typescript-eslint/eslint-plugin": "^5.2.0",
- "@typescript-eslint/parser": "^5.2.0",
- "babel-eslint": "^10.0.1",
- "babel-jest": "^25.3.0",
- "babel-loader": "^8.1.0",
- "chalk": "^2.3.2",
- "commander": "^6.0.0",
- "copy-webpack-plugin": "^9.0.1",
- "css-loader": "^0.28.11",
- "eslint": "^7.32.0",
- "eslint-config-babel": "^8.0.2",
- "eslint-config-standard": "^16.0.3",
- "eslint-friendly-formatter": "^4.0.1",
- "eslint-plugin-html": "^6.2.0",
- "eslint-plugin-import": "^2.25.2",
- "eslint-plugin-local-rules": "^0.1.0",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-prettier": "^2.6.2",
- "eslint-plugin-promise": "^5.1.1",
- "eslint-plugin-standard": "^4.0.0",
- "eslint-webpack-plugin": "^3.1.1",
- "html-loader": "^0.5.5",
- "html-webpack-plugin": "^5.3.2",
- "http-server": "^0.12.0",
- "jest": "^24.9.0",
- "json5": "^2.2.0",
- "less": "^4.1.3",
- "less-loader": "^11.1.0",
- "link-module-alias": "^1.2.0",
- "miniprogram-simulate": "^1.1.6",
- "npm-run-all": "^4.1.5",
- "path": "^0.12.7",
- "progress-bar-webpack-plugin": "^2.1.0",
- "rimraf": "^2.6.2",
- "stylus": "^0.54.5",
- "stylus-loader": "^3.0.2",
- "ts-loader": "^6.0.0",
- "typescript": "^4.1.2",
- "vue-loader": "^15.9.3",
- "vue-router": "^3.1.3",
- "vue-style-loader": "^4.1.2",
- "vue-template-compiler": "^2.6.10",
- "webpack": "^5.48.0",
- "webpack-bundle-analyzer": "^4.5.0",
- "webpack-cli": "^4.9.2",
- "webpack-merge": "^5.8.0"
- }
-}
diff --git a/test/e2e/miniprogram-wxss-loader/postcss.config.js b/test/e2e/miniprogram-wxss-loader/postcss.config.js
deleted file mode 100644
index affde7208f..0000000000
--- a/test/e2e/miniprogram-wxss-loader/postcss.config.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = {
- plugins: [
- require('autoprefixer')({ remove: false })
- ]
-}
diff --git a/test/e2e/miniprogram-wxss-loader/src/app.mpx b/test/e2e/miniprogram-wxss-loader/src/app.mpx
deleted file mode 100644
index f5f2b80729..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/app.mpx
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/index.html b/test/e2e/miniprogram-wxss-loader/src/index.html
deleted file mode 100644
index c2a5176b1a..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
- mpx-test
-
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx
deleted file mode 100644
index ed5920b7f4..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/pages/index/index.mpx
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- wxcss-loader test
-
-
-
-
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx
deleted file mode 100644
index 0fd4345a5b..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/pages/once/index.mpx
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- wxcss-loader test preCompileIgnore
-
-
-
-
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx
deleted file mode 100644
index ddf36cdc49..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/pages/other/index.mpx
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- wxcss-loader test preCompileIgnore
-
-
-
-
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx b/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx
deleted file mode 100644
index 5378828254..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/pages/scoped/index.mpx
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- wxcss-loader test preCompileIgnore
-
-
-
-
-
-
-
-
-
diff --git a/test/e2e/miniprogram-wxss-loader/src/static/img/test.png b/test/e2e/miniprogram-wxss-loader/src/static/img/test.png
deleted file mode 100644
index 58fa0b57f0..0000000000
Binary files a/test/e2e/miniprogram-wxss-loader/src/static/img/test.png and /dev/null differ
diff --git a/test/e2e/miniprogram-wxss-loader/src/styless/global.css b/test/e2e/miniprogram-wxss-loader/src/styless/global.css
deleted file mode 100644
index 316570974d..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/styless/global.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.title-wrapper {
- font-size: 30rpx;
-}
\ No newline at end of file
diff --git a/test/e2e/miniprogram-wxss-loader/src/styless/global.less b/test/e2e/miniprogram-wxss-loader/src/styless/global.less
deleted file mode 100644
index 95cc5fd1b5..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/styless/global.less
+++ /dev/null
@@ -1,5 +0,0 @@
-html {
- body {
- font-size: 24rpx;
- }
-}
\ No newline at end of file
diff --git a/test/e2e/miniprogram-wxss-loader/src/utils/common.js b/test/e2e/miniprogram-wxss-loader/src/utils/common.js
deleted file mode 100644
index f7473935a4..0000000000
--- a/test/e2e/miniprogram-wxss-loader/src/utils/common.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-export const commonName = 'blackgan common util common name'
diff --git a/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json b/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json
deleted file mode 100644
index 37b4002f92..0000000000
--- a/test/e2e/miniprogram-wxss-loader/static/ali/mini.project.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "component2": true
-}
\ No newline at end of file
diff --git a/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json b/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json
deleted file mode 100644
index 54761aa523..0000000000
--- a/test/e2e/miniprogram-wxss-loader/static/swan/project.swan.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilation-args": {
- "common": {
- "ignoreTransJs": true,
- "ignoreUglify": true
- },
- "options": [],
- "selected": -3
- },
- "projectname": "mpx-feature-unit-test",
- "setting": {
- "urlCheck": true
- }
-}
diff --git a/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json b/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json
deleted file mode 100644
index 1110fd0c69..0000000000
--- a/test/e2e/miniprogram-wxss-loader/static/tt/project.config.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "setting": {
- "urlCheck": true,
- "es6": false,
- "postcss": false,
- "minified": false,
- "newFeature": true
- },
- "appid": "testAppId",
- "projectname": "mpx-feature-unit-test"
-}
diff --git a/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json b/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json
deleted file mode 100644
index 2bdc3cc097..0000000000
--- a/test/e2e/miniprogram-wxss-loader/static/wx/project.config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "compileType": "miniprogram",
- "setting": {
- "newFeature": true,
- "urlCheck": true,
- "es6": false,
- "postcss": false,
- "minified": false,
- "checkSiteMap": false,
- "autoAudits": false
- },
- "appid": "touristappid",
- "projectname": "mpx-feature-unit-test",
- "description": "mpx feature unit test",
- "condition": {}
-}
diff --git a/test/e2e/miniprogram-wxss-loader/test/index.spec.js b/test/e2e/miniprogram-wxss-loader/test/index.spec.js
deleted file mode 100644
index 2a22237c23..0000000000
--- a/test/e2e/miniprogram-wxss-loader/test/index.spec.js
+++ /dev/null
@@ -1,178 +0,0 @@
-const simulate = require('@mpxjs/miniprogram-simulate')
-const fs = require('fs')
-const path = require('path')
-const { resolveDist, resolve } = require('./util')
-
-function loadComponent (componentPathStr) {
- const outputMap = require(resolveDist('outputMap.json', 'wx'))
- const componentPath = resolve(componentPathStr)
- const realComponentPath = resolveDist(outputMap[componentPath], 'wx')
- return simulate.load(realComponentPath, undefined, {
- rootPath: resolveDist('', 'wx')
- })
-}
-
-function getBuildOutFilePath (componentPathStr, mode) {
- const outputMap = require(resolveDist('outputMap.json', mode))
- const componentPath = resolve(componentPathStr)
- return resolveDist(outputMap[componentPath], mode)
-}
-
-function readFile (path) {
- const result = fs.readFileSync(path, 'utf-8')
- return result
-}
-
-describe('index page', () => {
- let id
- beforeAll(() => {
- id = loadComponent('src/pages/index/index.mpx')
- })
- let comp = null
- let parent = null
- beforeEach(() => {
- comp = simulate.render(id)
- parent = document.createElement('parent-wrapper') // 创建容器节点
- comp.attach(parent) // 挂载组件到容器节点
- })
-
- it('when the style import css file, it will draw out of this file', async () => {
- const { mode, css } = {
- mode: 'wx',
- css: '.wxss'
- }
-
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/index/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- const cssImportCode = `@import "../../styless/global43985ba5/index${css}";`
- const outputDir = resolveDist('', mode)
- const outputStylePath = path.join(
- outputDir,
- `styless/global43985ba5/index${css}`
- )
- const styleContent = await fs.readFileSync(outputStylePath, 'utf8')
-
- expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true)
- expect(
- styleContent.includes(`
-.title-wrapper {
- font-size: 30rpx;
-}`)
- ).toBe(true)
- })
-
- it('When ali mode, the style import css file, it will draw out of this file', async () => {
- const { mode, css } = {
- mode: 'ali',
- css: '.acss'
- }
-
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/index/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- const cssImportCode = `@import "../../styless/global43985ba5/index${css}";`
- const outputDir = resolveDist('', mode)
- const outputStylePath = path.join(
- outputDir,
- `styless/global43985ba5/index${css}`
- )
- const styleContent = await fs.readFileSync(outputStylePath, 'utf8')
-
- expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true)
- expect(
- styleContent.includes(`
-.title-wrapper {
- font-size: 30rpx;
-}`)
- ).toBe(true)
- })
-
- it("when wx mode, use /* @mpx-import 'xx.less' */ note,the less-loader、stylus-loader or other preLoaders will ignore the import file compilation,finally draw out of this file", async () => {
- const { mode, css } = {
- mode: 'wx',
- css: '.wxss'
- }
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/other/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- const cssImportCode = `@import "../../styless/global2f76fc37/index${css}";`
- const outputDir = resolveDist('', mode)
- const outputStylePath = path.join(
- outputDir,
- `styless/global2f76fc37/index${css}`
- )
- const styleContent = await fs.readFileSync(outputStylePath, 'utf8')
-
- expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true)
- expect(
- styleContent.includes(`
-html body {
- font-size: 24rpx;
-}`)
- ).toBe(true)
- })
-
- it("when ali mode, use /* @mpx-import 'xx.less' */ note,the less-loader、stylus-loader or other preLoaders will ignore the import file compilation,finally draw out of this file", async () => {
- const { mode, css } = {
- mode: 'ali',
- css: '.acss'
- }
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/other/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- const cssImportCode = `@import "../../styless/global2f76fc37/index${css}";`
- const outputDir = resolveDist('', mode)
- const outputStylePath = path.join(
- outputDir,
- `styless/global2f76fc37/index${css}`
- )
- const styleContent = await fs.readFileSync(outputStylePath, 'utf8')
-
- expect(listComponentCss.indexOf(cssImportCode) !== -1).toBe(true)
- expect(
- styleContent.includes(`
-html body {
- font-size: 24rpx;
-}`)
- ).toBe(true)
- })
-
- it('when use ali mode, it should correctly contain css scope feature', async () => {
- const { mode, css } = {
- mode: 'ali',
- css: '.acss'
- }
-
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/scoped/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- expect(/.title\../.test(listComponentCss)).toBe(true)
- })
-
- it('import common url more than two times, finally it will be parse once', async () => {
- const { mode, css } = {
- mode: 'wx',
- css: '.wxss'
- }
-
- const listComponentPath = getBuildOutFilePath(
- 'src/pages/once/index.mpx',
- mode
- )
- const listComponentCss = readFile(listComponentPath + css)
- const REGEXP = /(@import[\s]+["|'].+wxss["|'];)/g
- const matched = listComponentCss.match(REGEXP)
- expect(matched.length).toBe(1)
- })
-})
diff --git a/test/e2e/miniprogram-wxss-loader/test/util.js b/test/e2e/miniprogram-wxss-loader/test/util.js
deleted file mode 100644
index ae168c7af1..0000000000
--- a/test/e2e/miniprogram-wxss-loader/test/util.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import path from 'path'
-
-export function resolveDist (dir, mode = 'wx') {
- return path.join(__dirname, `../dist/${mode}`, dir)
-}
-
-export function resolve (file) {
- return path.join(__dirname, '..', file || '')
-}
diff --git a/test/e2e/plugin-project/copyWebpackPlugin.sh b/test/e2e/plugin-project/copyWebpackPlugin.sh
deleted file mode 100644
index 46ca1928b4..0000000000
--- a/test/e2e/plugin-project/copyWebpackPlugin.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-echo "start copy webpackPlugin"
-
-rm -rf ./node_modules/@mpxjs/webpack-plugin/lib
-
-scp -r ../../../packages/webpack-plugin/lib/ ./node_modules/@mpxjs/webpack-plugin/lib/
-
-echo "end copy webpackPlugin"
diff --git a/test/e2e/plugin-project/package.json b/test/e2e/plugin-project/package.json
index a4d6f7f912..2c9cce44ff 100644
--- a/test/e2e/plugin-project/package.json
+++ b/test/e2e/plugin-project/package.json
@@ -8,7 +8,7 @@
"watch:prod": "node ./build/build.js -w -p",
"build": "node ./build/build.js -p",
"build:dev": "node ./build/build.js",
- "copyPlugin": "sh ./copyWebpackPlugin.sh",
+ "copyPlugin": "sh ../copyWebpackPlugin.sh",
"watch:cross": "npm run watch --modes=wx,ali,web",
"build:cross": "npm run build --modes=wx,ali,web",
"watch:web:serve": "npx npm-run-all --parallel watch:web serve",
@@ -22,12 +22,14 @@
"author": "xuegan ",
"license": "ISC",
"dependencies": {
- "@mpxjs/api-proxy": "^2.7.1",
- "@mpxjs/core": "^2.9.1",
- "@mpxjs/store": "^2.8.15",
- "semver": "^7.5.4",
"vue": "^2.6.10",
- "vue-i18n": "^8.15.3"
+ "vue-i18n": "^8.15.3",
+ "@mpxjs/api-proxy": "^2.8.0",
+ "@mpxjs/core": "^2.8.0",
+ "@mpxjs/fetch": "^2.8.0",
+ "@mpxjs/pinia": "^2.8.0",
+ "@mpxjs/store": "^2.8.0",
+ "@mpxjs/utils": "^2.8.0"
},
"browserslist": [
"ios >= 9",
@@ -42,7 +44,7 @@
"@babel/runtime-corejs3": "^7.10.4",
"@mpxjs/miniprogram-simulate": "^1.4.17",
"@mpxjs/mpx-jest": "0.0.27",
- "@mpxjs/webpack-plugin": "^2.7.2",
+ "@mpxjs/webpack-plugin": "^2.8.0",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"autoprefixer": "^6.3.1",