本文整理汇总了TypeScript中webpack-merge.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: includeClientPackages
externals: includeClientPackages(
/@angularclass|@angular|angular2-|ng2-|ng-|@ng-|angular-|@ngrx|ngrx-|@angular2|ionic|@ionic|-angular2|-ng2|-ng/
),
node: {
global: true,
crypto: true,
__dirname: true,
__filename: true,
process: true,
Buffer: true
}
};
export default [
// Client
webpackMerge(clone(commonConfig), clientConfig, { plugins: clientPlugins.concat(commonPlugins) }),
// Server
webpackMerge(clone(commonConfig), serverConfig, { plugins: serverPlugins.concat(commonPlugins) })
];
// Helpers
export function includeClientPackages(packages, localModule?: string[]) {
return function(context, request, cb) {
if (localModule instanceof RegExp && localModule.test(request)) {
return cb();
}
if (packages instanceof RegExp && packages.test(request)) {
开发者ID:Hongbo-Miao,项目名称:universal-starter,代码行数:31,代码来源:webpack.config.ts
示例2: webpackMerge
import webpack from 'webpack';
import webpackMerge from 'webpack-merge';
import webpackDevConfig from '@eng/webpack/webpack.development.config';
const config: webpack.Configuration = webpackMerge(webpackDevConfig, {
entry: {
app: ['webpack-hot-middleware/client'],
},
});
export default config;
开发者ID:athrunsun,项目名称:oh-my-stars,代码行数:12,代码来源:webpack.devserver.config.ts
示例3: root
context: __dirname,
resolve: {
root: root('/src')
},
output: {
publicPath: path.resolve(__dirname),
filename: 'index.js'
}
}
var webpackMerge = require('webpack-merge');
module.exports = [
// Client
webpackMerge({}, defaultConfig, commonConfig, clientConfig),
//Styles
webpackMerge({}, defaultConfig, commonConfig, stylesConfig),
// Server
webpackMerge({}, defaultConfig, commonConfig, serverConfig)
]
// Helpers
function checkNodeImport(context, request, cb) {
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
cb(null, 'commonjs ' + request); return;
}
cb();
}
开发者ID:ardiadrianadri,项目名称:universal-starter,代码行数:31,代码来源:webpack.config.ts
示例4: default
export default ({
entry,
rules,
hash = true,
useTypeScript,
tsLoaderType = TsLoaderType.Default,
tsconfig = paths.client.tsconfig,
}: ClientConfigOptions): Configuration => {
const { tsBaseRule, ...restRules } = clientDefaultRules;
const preparedRules = useTypeScript
? {
tsRule: {
...tsBaseRule,
use: loaders.getTsLoader({ loaderType: tsLoaderType, forkedChecks: true, tsconfig }),
},
...restRules,
}
: { ...restRules };
const moduleRules = mergeAndReplaceRules(preparedRules, rules);
return webpackMerge(
commonConfig({
outputPath: paths.client.output.path,
outputPublicPath: appConfig.client.output.publicPath,
outputJsDir: appConfig.client.output.js,
hash,
useTypeScript,
tsLoaderType,
tsconfig,
}),
{
name: appConfig.client.root,
target: 'web',
context: paths.client.sources,
entry,
resolve: {
modules: [paths.client.sources],
alias: {
// for universal projects
shared: paths.shared.sources,
},
},
// recordsOutputPath: path.join(paths.output.path, 'webpack.client.stats.json'),
module: {
rules: [
...Object.getOwnPropertyNames(moduleRules).map(name => moduleRules[name] || {}),
// Provide pug loader if html template is pug template
...(appConfig.client.html.template && appConfig.client.html.template.endsWith('.pug')
? [{ test: /\.pug$/, use: { loader: 'pug-loader' } }]
: []),
],
},
plugins: [
// Generate html if needed
appConfig.client.html.template &&
(() => {
const { template, ...rest } = appConfig.client.html;
const getName = (): string => 'html-webpack-plugin';
const HtmlWebpackPlugin = nodeRequire(getName());
return new HtmlWebpackPlugin({
inject: false,
template: path.join(paths.client.sources, template),
...rest,
});
})(),
// Extract css in production only if has mini-css-extract-plugin loader
appEnv.prod &&
containsLoader(moduleRules, cssExtractLoader) &&
(() => {
const getName = (): string => 'mini-css-extract-plugin';
const MiniCssExtractPlugin = nodeRequire(getName());
const hashStr = appEnv.prod && hash ? '.[contenthash:8]' : '';
return new MiniCssExtractPlugin({
filename: `${appConfig.client.output.styles}/[name]${hashStr}.css`,
chunkFilename: `${appConfig.client.output.styles}/[name]${hashStr}.chunk.css`,
});
})(),
// Generate a manifest file which contains a mapping of all asset filenames
// to their corresponding output file so some tools can pick it up without
// having to parse `index.html`.
appConfig.client.output.assetManifest.fileName &&
(() => {
const { fileName, filterTemplate } = appConfig.client.output.assetManifest;
const isNeedFilter =
!!filterTemplate && !!Object.getOwnPropertyNames(filterTemplate).length;
const getName = (): string => 'webpack-manifest-plugin';
const WebpackManifestPlugin = nodeRequire(getName());
return new WebpackManifestPlugin({
fileName,
//.........这里部分代码省略.........
开发者ID:vlazh,项目名称:configs,代码行数:101,代码来源:client.config.ts
示例5: buildConfig
public buildConfig() {
const platformConfig = this.wco.appConfig.platform === 'server' ?
getServerConfig(this.wco) : getBrowserConfig(this.wco);
let webpackConfigs = [
getCommonConfig(this.wco),
platformConfig,
getStylesConfig(this.wco),
];
if (this.wco.appConfig.main || this.wco.appConfig.polyfills) {
const typescriptConfigPartial = this.wco.buildOptions.aot
? getAotConfig(this.wco)
: getNonAotConfig(this.wco);
webpackConfigs.push(typescriptConfigPartial);
}
this.config = webpackMerge(webpackConfigs);
return this.config;
}
开发者ID:log2-hwan,项目名称:angular-cli,代码行数:20,代码来源:webpack-config.ts
示例6: constructor
constructor(extractOptions: XI18WebpackOptions) {
super({
target: 'development',
verbose: extractOptions.verbose,
progress: extractOptions.progress
});
const configPath = CliConfig.configFilePath();
const projectRoot = path.dirname(configPath);
const appConfig = CliConfig.fromProject().config.apps[0];
const extractI18nConfig =
getWebpackExtractI18nConfig(projectRoot,
appConfig,
extractOptions.genDir,
extractOptions.i18nFormat);
this.config = webpackMerge([this.config, extractI18nConfig]);
}
开发者ID:Percyman,项目名称:angular-cli,代码行数:20,代码来源:webpack-xi18n-config.ts
示例7: _buildWebpackConfig
private _buildWebpackConfig(
root: Path,
projectRoot: Path,
host: virtualFs.Host<fs.Stats>,
options: NormalizedKarmaBuilderSchema,
) {
let wco: WebpackConfigOptions;
const tsConfigPath = getSystemPath(resolve(root, normalize(options.tsConfig)));
const tsConfig = readTsconfig(tsConfigPath);
const projectTs = requireProjectModule(getSystemPath(projectRoot), 'typescript') as typeof ts;
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;
const compatOptions: typeof wco['buildOptions'] = {
...options as {} as typeof wco['buildOptions'],
// Some asset logic inside getCommonConfig needs outputPath to be set.
outputPath: '',
};
wco = {
root: getSystemPath(root),
projectRoot: getSystemPath(projectRoot),
// TODO: use only this.options, it contains all flags and configs items already.
buildOptions: compatOptions,
tsConfig,
tsConfigPath,
supportES2015,
};
const webpackConfigs: {}[] = [
getCommonConfig(wco),
getStylesConfig(wco),
getNonAotTestConfig(wco, host),
getTestConfig(wco),
];
return webpackMerge(webpackConfigs);
}
开发者ID:rexebin,项目名称:angular-cli,代码行数:41,代码来源:index.ts
示例8: webpackMerge
buildWebpackConfig(
root: Path,
projectRoot: Path,
host: virtualFs.Host<fs.Stats>,
options: NormalizedBrowserBuilderSchema,
) {
let wco: WebpackConfigOptions<NormalizedBrowserBuilderSchema>;
const tsConfigPath = getSystemPath(normalize(resolve(root, normalize(options.tsConfig))));
const tsConfig = readTsconfig(tsConfigPath);
const projectTs = requireProjectModule(getSystemPath(projectRoot), 'typescript') as typeof ts;
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;
wco = {
root: getSystemPath(root),
projectRoot: getSystemPath(projectRoot),
buildOptions: options,
tsConfig,
tsConfigPath,
supportES2015,
};
const webpackConfigs: {}[] = [
getCommonConfig(wco),
getBrowserConfig(wco),
getStylesConfig(wco),
getStatsConfig(wco),
];
if (wco.buildOptions.main || wco.buildOptions.polyfills) {
const typescriptConfigPartial = wco.buildOptions.aot
? getAotConfig(wco, host)
: getNonAotConfig(wco, host);
webpackConfigs.push(typescriptConfigPartial);
}
return webpackMerge(webpackConfigs);
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:41,代码来源:index.ts
示例9: ExtractTextPlugin
/**
* Created by Jean-paul.attard on 06/09/2016.
*/
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonWebpackConfig = require('./webpack.common');
var helpers = require('./helpers');
module.exports = webpackMerge(commonWebpackConfig, {
devtool: 'cheap-module-eval-source-map',
output: {
path: helpers.root('dist'),
publicPath: 'http://localhost:4000/',
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
plugins: [
new ExtractTextPlugin('[name].css')
],
devServer: {
historyApiFallback: true,
stats: 'minimal'
}
});
开发者ID:jeanpaulattard,项目名称:tourofheroes,代码行数:28,代码来源:webpack.dev.ts
示例10: DefinePlugin
{
test: /\.json$/,
use: ['json-loader']
}
]
}
};
export const plugins = [
new DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
new LoaderOptionsPlugin({
debug: false,
options: {
postcss: [
autoprefixer({ browsers: ['last 3 versions', 'Firefox ESR'] })
],
resolve: {}
}
})
];
module.exports = webpackMerge(
config,
{ plugins }
);
开发者ID:jussikinnula,项目名称:angular2-socketio-chat-example,代码行数:30,代码来源:webpack.test.ts
注:本文中的webpack-merge.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论