@sanpjs/bundler-webpack
Version:
@sanpjs/bundler-webpack
39 lines (38 loc) • 1.56 kB
TypeScript
/**
* Copyright (c) Baidu Inc. All rights reserved.
*
* This source code is licensed under the MIT license.
* See LICENSE file in the project root for license information.
*
* @file 跟路径相关函数
* @author ksky521
*/
import { ILoader, ILoaders, Configuration, RuleSetUseItem } from '../../types';
export declare const getLoader: ILoader;
export declare const getLoaders: ILoaders;
/**
* 替换指定规则
* @param {RegExp} test webpack.module.rules的条件test 例如:/\.less$/
* @param {array} use rule下的指定的use 例如:[{loader: 'less-loader', options: {}}]
* @param {object} config webpackConfig对象
*/
export declare const replaceRule: (test: string | RegExp, use: RuleSetUseItem, config: Configuration) => void;
/**
* 替换指定规则的某一loader配置
* @param {RegExp} test webpack.module.rule的条件test 例如:/\.less$/
* @param {string} loader rule下的指定loader 例如:less-loader
* @param {object} options 新的配置,将直接替换已有配置
* @param {object} config webpackConfig对象
*/
export declare const replaceOption: (test: string | RegExp, loader: string, options: string | {
[index: string]: any;
}, config: Configuration) => void;
export declare const defineVar: (raw: boolean) => {
NODE_ENV: string | undefined;
PRODUCTION: boolean;
};
export declare const copyFiles: (copyConfig: (string | {
from: string;
to: string;
})[], root: string, target: string) => void;
export declare const getAssetPath: (assetDir: string, filePath: string) => string;