chore(cli): imporve resolve path (#8496)

This commit is contained in:
neverland 2021-04-10 14:53:34 +08:00 committed by GitHub
parent d7bb080805
commit a066e3a4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -17,25 +17,25 @@ module.exports = function (api?: ConfigAPI, options: PresetOption = {}) {
return {
presets: [
[
'@babel/preset-env',
require.resolve('@babel/preset-env'),
{
modules: useESModules ? false : 'commonjs',
loose: options.loose,
},
],
'@babel/preset-typescript',
require.resolve('@babel/preset-typescript'),
require('../compiler/babel-preset-vue-ts'),
],
plugins: [
[
'@babel/plugin-transform-runtime',
require.resolve('@babel/plugin-transform-runtime'),
{
corejs: false,
useESModules,
},
],
[
'import',
require.resolve('babel-plugin-import'),
{
libraryName: 'vant',
libraryDirectory: useESModules ? 'es' : 'lib',
@ -44,7 +44,7 @@ module.exports = function (api?: ConfigAPI, options: PresetOption = {}) {
'vant',
],
[
'@vue/babel-plugin-jsx',
require.resolve('@vue/babel-plugin-jsx'),
{
enableObjectSlots: options.enableObjectSlots,
},

View File

@ -14,10 +14,10 @@ import {
} from '../common/constant';
const CSS_LOADERS = [
'style-loader',
'css-loader',
require.resolve('style-loader'),
require.resolve('css-loader'),
{
loader: 'postcss-loader',
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: require(POSTCSS_CONFIG_FILE),
},
@ -25,7 +25,7 @@ const CSS_LOADERS = [
];
const VUE_LOADER = {
loader: 'vue-loader',
loader: require.resolve('vue-loader'),
options: {
compilerOptions: {
preserveWhitespace: false,
@ -88,7 +88,7 @@ export const baseConfig: WebpackConfig = {
{
test: /\.(js|ts|jsx|tsx)$/,
exclude: /node_modules\/(?!(@vant\/cli))/,
use: ['babel-loader'],
use: [require.resolve('babel-loader')],
},
{
test: /\.css$/,
@ -98,7 +98,7 @@ export const baseConfig: WebpackConfig = {
{
test: /\.less$/,
sideEffects: true,
use: [...CSS_LOADERS, 'less-loader'],
use: [...CSS_LOADERS, require.resolve('less-loader')],
},
{
test: /\.scss$/,
@ -106,7 +106,7 @@ export const baseConfig: WebpackConfig = {
use: [
...CSS_LOADERS,
{
loader: 'sass-loader',
loader: require.resolve('sass-loader'),
options: {
implementation: sass,
},
@ -115,7 +115,7 @@ export const baseConfig: WebpackConfig = {
},
{
test: /\.md$/,
use: [VUE_LOADER, '@vant/markdown-loader'],
use: [VUE_LOADER, require.resolve('@vant/markdown-loader')],
},
],
},