mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
[Build] add object assign transform (#1713)
This commit is contained in:
parent
a8faa89dfa
commit
ed11471b68
@ -1,8 +1,8 @@
|
||||
module.exports = function(api) {
|
||||
const { BABEL_MODULE } = process.env;
|
||||
const useESModules = BABEL_MODULE !== 'commonjs';
|
||||
const { BABEL_MODULE, NODE_ENV } = process.env;
|
||||
const useESModules = BABEL_MODULE !== 'commonjs' && NODE_ENV !== 'test';
|
||||
|
||||
api.cache(false);
|
||||
api && api.cache(false);
|
||||
|
||||
return {
|
||||
presets: [
|
||||
@ -10,7 +10,7 @@ module.exports = function(api) {
|
||||
'@babel/preset-env',
|
||||
{
|
||||
loose: true,
|
||||
modules: BABEL_MODULE || false
|
||||
modules: useESModules ? false : 'commonjs'
|
||||
}
|
||||
]
|
||||
],
|
||||
@ -24,7 +24,8 @@ module.exports = function(api) {
|
||||
useESModules
|
||||
}
|
||||
],
|
||||
'@babel/plugin-syntax-dynamic-import'
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-transform-object-assign'
|
||||
]
|
||||
};
|
||||
};
|
||||
|
@ -1,7 +1,8 @@
|
||||
module.exports = {
|
||||
setupFiles: ['<rootDir>/test/jest.init.js'],
|
||||
moduleFileExtensions: ['js', 'vue'],
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
|
||||
'^.+\\.js$': '<rootDir>/test/jest.transform.js',
|
||||
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
|
||||
},
|
||||
moduleNameMapper: {
|
||||
|
@ -61,11 +61,14 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-transform-object-assign": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@vue/server-test-utils": "^1.0.0-beta.24",
|
||||
"@vue/test-utils": "^1.0.0-beta.24",
|
||||
"autoprefixer": "^9.1.3",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-jest": "^23.4.2",
|
||||
"babel-loader": "^8.0.0",
|
||||
"codecov": "^3.0.4",
|
||||
|
1
test/jest.init.js
Normal file
1
test/jest.init.js
Normal file
@ -0,0 +1 @@
|
||||
require('@babel/polyfill');
|
3
test/jest.transform.js
Normal file
3
test/jest.transform.js
Normal file
@ -0,0 +1,3 @@
|
||||
const babelConfig = require('../babel.config');
|
||||
|
||||
module.exports = require('babel-jest').createTransformer(babelConfig());
|
23
yarn.lock
23
yarn.lock
@ -506,6 +506,12 @@
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-transform-object-assign@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.0.0.tgz#fca6d7500d9675c42868b8f3882979201b9a5ad8"
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-transform-object-super@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.0.0.tgz#b8587d511309b3a0e96e9e38169908b3e392041e"
|
||||
@ -575,6 +581,13 @@
|
||||
"@babel/helper-regex" "^7.0.0"
|
||||
regexpu-core "^4.1.3"
|
||||
|
||||
"@babel/polyfill@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0.tgz#c8ff65c9ec3be6a1ba10113ebd40e8750fb90bff"
|
||||
dependencies:
|
||||
core-js "^2.5.7"
|
||||
regenerator-runtime "^0.11.1"
|
||||
|
||||
"@babel/preset-env@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.0.0.tgz#f450f200c14e713f98cb14d113bf0c2cfbb89ca9"
|
||||
@ -1422,6 +1435,10 @@ babel-core@^6.26.0:
|
||||
slash "^1.0.0"
|
||||
source-map "^0.5.6"
|
||||
|
||||
babel-core@^7.0.0-0:
|
||||
version "7.0.0-bridge.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
|
||||
|
||||
babel-eslint@^8.2.3:
|
||||
version "8.2.3"
|
||||
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.3.tgz#1a2e6681cc9bc4473c32899e59915e19cd6733cf"
|
||||
@ -2409,6 +2426,10 @@ core-js@^2.4.0, core-js@^2.5.0:
|
||||
version "2.5.5"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.5.tgz#b14dde936c640c0579a6b50cabcc132dd6127e3b"
|
||||
|
||||
core-js@^2.5.7:
|
||||
version "2.5.7"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
|
||||
|
||||
core-util-is@1.0.2, core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
@ -8043,7 +8064,7 @@ regenerate@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
|
||||
|
||||
regenerator-runtime@^0.11.0:
|
||||
regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:
|
||||
version "0.11.1"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user