本文整理汇总了TypeScript中@easy-webpack/core.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: css
return function css(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
const loaders = ['style-loader', `css-loader${sourceMap ? '?sourceMap' : ''}`]
if (resolveRelativeUrl) {
loaders.push(`resolve-url-loader${sourceMap ? '?sourceMap' : ''}`)
sourceMap = true // source maps need to be on for this
}
if (additionalLoaders) {
loaders.push(...additionalLoaders)
}
const extractCss = extractText !== false
const providedInstance = extractText instanceof ExtractTextPlugin
const extractTextInstances: Map<string, any> = this.metadata.extractTextInstances = this.metadata.extractTextInstances || new Map()
if (!providedInstance) {
if (extractCss) {
extractText = extractTextInstances.get(filename)
if (!extractText) {
extractText = new ExtractTextPlugin(extractText instanceof Object ? extractText : { filename, allChunks })
extractTextInstances.set(filename, extractText)
}
} else {
extractText = null
}
}
const config = {
module: {
rules: get(this, 'module.rules', []).concat([{
test,
use: extractCss ?
extractText.extract({ fallback: loaders[0], use: loaders.slice(1) }) :
loaders
}])
},
metadata: {
extractTextInstances
}
} as WebpackConfigWithMetadata
const plugins = get(this, 'plugins', [])
if (extractText && !providedInstance && !(this.plugins || []).find(plugin => (plugin === extractText) || (plugin instanceof ExtractTextPlugin && (plugin as any).id === extractText.id))) {
config.plugins = [
/**
* Plugin: ExtractTextPlugin
* It moves every import "style.css" in entry chunks into a single concatenated css output file.
* So your styles are no longer inlined into the javascript, but separate in a css bundle file (styles.css).
* If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle.
*/
extractText
].concat(plugins)
}
if (resolveRelativeUrl instanceof Object) {
config['resolveUrlLoader'] = resolveRelativeUrl
}
return config
}
示例2: aurelia
return function aurelia(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
metadata: {
title,
baseUrl,
root,
src,
},
resolve: {
modules: [src].concat(get(this, 'resolve.modules', ['node_modules']))
},
plugins: [
new AureliaWebpackPlugin(allOptions)
].concat(get(this, 'plugins', []))
}
}
示例3: offline
return function offline(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
plugins: get(this, 'plugins', []).concat([
new OfflinePlugin(options),
])
}
}
示例4: sourceMapSupport
return function sourceMapSupport(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
const config = {
plugins: [
new webpack.BannerPlugin({
banner: `require('source-map-support').install();`,
raw: true, entryOnly: false
})
].concat(get(this, 'plugins', []))
} as WebpackConfigWithMetadata
if (!browser) {
config.externals = [
'source-map-support',
].concat(get(this, 'externals', []))
}
return config
}
示例5: copyFiles
return function copyFiles(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
plugins: [
new CopyWebpackPlugin(patterns, options)
].concat(get(this, 'plugins', []))
}
}
示例6: bluebird
return function bluebird(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
const config = {
plugins: [
new webpack.ProvidePlugin({
'Promise': 'bluebird',
})
].concat(get(this, 'plugins', []))
} as WebpackConfigWithMetadata
if (expose) {
config.module = {
rules: get(this, 'module.rules', []).concat([
{ test: /[\/\\]node_modules[\/\\]bluebird[\/\\].+\.js$/, loader: 'expose-loader?Promise' }
])
}
}
return config
}
示例7: regenerator
return function regenerator(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
plugins: [
new webpack.ProvidePlugin({
'regeneratorRuntime': 'regenerator-runtime', // required for await-async
})
].concat(get(this, 'plugins', []))
}
}
示例8: tslint
return function tslint(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
module: {
rules: get(this, 'module.rules', []).concat([
{ test: /\.tsx?$/, loader: 'tslint-loader', enforce: 'pre', exclude: exclude || (this.metadata.root ? [path.join(this.metadata.root, 'node_modules')] : []) }
])
}
}
}
示例9: html
return function html(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
module: {
rules: get(this, 'module.rules', []).concat([{
test: /\.html$/,
loader: 'html-loader',
exclude: exclude || (this.metadata.root ? [path.join(this.metadata.root, 'index.html')] : []),
}])
}
}
}
示例10: json
return function json(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
return {
module: {
rules: get(this, 'module.rules', []).concat([{
test: /\.json$/i,
loader: 'json-loader',
exclude: exclude || (this.metadata.root ? [path.join(this.metadata.root, 'node_modules')] : []),
}])
}
}
}