本文整理汇总了TypeScript中@angularclass/resolve-angular-routes.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: webpackConfig
// type definition for WebpackConfig at the bottom
function webpackConfig(options: EnvOptions = {}): WebpackConfig {
const CONSTANTS = {
ENV: JSON.stringify(options.ENV),
HMR: options.HMR,
PORT: 3000,
HOST: 'localhost'
};
return {
cache: true,
// devtool: 'hidden-source-map',
devtool: 'source-map',
// devtool: 'cheap-module-eval-source-map',
entry: {
polyfills: './src/polyfills.browser',
vendor: './src/vendor.browser',
main: './src/main.browser'
},
output: {
path: root('dist'),
filename: '[name].bundle.js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js'
},
module: {
preLoaders: [
// fix angular2
{
test: /(systemjs_component_resolver|system_js_ng_module_factory_loader)\.js$/,
loader: 'string-replace-loader',
query: {
search: '(lang_1(.*[\\n\\r]\\s*\\.|\\.))?(global(.*[\\n\\r]\\s*\\.|\\.))?(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import',
replace: 'System.import',
flags: 'g'
}
},
{
test: /.js$/,
loader: 'string-replace-loader',
query: {
search: 'moduleId: module.id,',
replace: '',
flags: 'g'
}
}
// end angular2 fix
],
loaders: [
// Support for .ts files.
{
test: /\.ts$/,
loaders: [
'awesome-typescript-loader',
'@angularclass/conventions-loader'
],
exclude: [/\.(spec|e2e|d)\.ts$/]
},
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.html/, loader: 'raw-loader' },
{ test: /\.css$/, loader: 'raw-loader' },
]
},
plugins: [
// fix angular2
new ContextReplacementPlugin(
/angular\/core\/src\/linker/,
root('./src'),
resolveNgRoute(root('./src'))
),
// end angular2 fix
new HotModuleReplacementPlugin(),
new ForkCheckerPlugin(),
new CommonsChunkPlugin({ name: ['main', 'vendor', 'polyfills'], minChunks: Infinity }),
new DefinePlugin(CONSTANTS),
new ProgressPlugin({})
],
resolve: {
extensions: ['', '.ts', '.js', '.json'],
},
devServer: {
contentBase: './src',
port: CONSTANTS.PORT,
hot: CONSTANTS.HMR,
inline: CONSTANTS.HMR,
historyApiFallback: true
},
//.........这里部分代码省略.........
示例2: root
},
module: {
loaders: [
// TypeScript
{ test: /\.ts$/, loaders: ['ts-loader', 'angular2-template-loader'] },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.json$/, loader: 'json-loader' }
],
},
plugins: [
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)src(\\|\/)linker/,
root('./src'),
resolveNgRoute(root('./src'))
)
]
};
var clientConfig = {
target: 'web',
entry: './src/client',
output: {
path: root('dist/client')
},
node: {
global: true,
__dirname: true,
__filename: true,
process: true,
示例3: webpackConfig
// type definition for WebpackConfig is defined in webpack.d.ts
function webpackConfig(options: EnvOptions = {}): WebpackConfig {
return {
devtool: '#source-map',
entry: {
polyfills: polyfills(options),
vendors: vendors(options)
},
output: {
path: root('dist/dll'),
filename: '[name].[hash].js',
sourceMapFilename: '[name].[hash].map',
library: "__[name]"
},
module: {
loaders: [
// fix angular2
{
test: /(systemjs_component_resolver|system_js_ng_module_factory_loader)\.js$/,
loader: 'string-replace-loader',
query: {
search: '(lang_1(.*[\\n\\r]\\s*\\.|\\.))?' +
'(global(.*[\\n\\r]\\s*\\.|\\.))?' +
'(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
replace: '$5.import($7)',
flags: 'g'
},
include: [root('node_modules/@angular/core')]
},
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
search: 'moduleId: module.id,',
replace: '',
flags: 'g'
}
},
// end angular2 fix
{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
exclude: [root('src/app')],
include: [root('./src')]
},
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
search: 'var sourceMappingUrl = extractSourceMappingUrl\\(cssText\\);',
replace: 'var sourceMappingUrl = "";',
flags: 'g'
}
},
{
test: /\.json$/,
loader: 'string-replace-loader',
query: {
search: '}(.*[\\n\\r]\\s*)}(.*[\\n\\r]\\s*)}"activeExports": \\[\\]',
replace: '',
flags: 'g'
}
}
]
},
plugins: [
new AssetsPlugin({
path: root('dist/dll'),
filename: 'webpack-assets.json',
prettyPrint: true
}),
new DllPlugin({
name: '__[name]',
path: root('dist/dll/[name]-manifest.json'),
}),
// fix angular2
new ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
root('./src'),
resolveNgRoute(root('./src'))
),
// end angular2 fix
new ProgressPlugin({}),
// https://github.com/webpack/webpack/issues/2764
// new DedupePlugin(),
],
node: {
global: true,
process: true,
Buffer: false,
crypto: 'empty',
//.........这里部分代码省略.........