本文整理匯總了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')] : []),
}])
}
}
}