当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript core.get函数代码示例

本文整理汇总了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
  }
开发者ID:easy-webpack,项目名称:config-css,代码行数:58,代码来源:index.ts

示例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', []))
   }
 }
开发者ID:easy-webpack,项目名称:config-aurelia,代码行数:16,代码来源:index.ts

示例3: offline

 return function offline(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
   return {
     plugins: get(this, 'plugins', []).concat([
       new OfflinePlugin(options),
     ])
   }
 }
开发者ID:easy-webpack,项目名称:config-offline,代码行数:7,代码来源:index.ts

示例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
 }
开发者ID:easy-webpack,项目名称:config-source-map-support,代码行数:16,代码来源:index.ts

示例5: copyFiles

 return function copyFiles(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
   return {
     plugins: [
       new CopyWebpackPlugin(patterns, options)
     ].concat(get(this, 'plugins', []))
   }
 }
开发者ID:easy-webpack,项目名称:config-copy-files,代码行数:7,代码来源:index.ts

示例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
  }
开发者ID:easy-webpack,项目名称:config-global-bluebird,代码行数:18,代码来源:index.ts

示例7: regenerator

 return function regenerator(this: WebpackConfigWithMetadata): WebpackConfigWithMetadata {
   return {
     plugins: [
       new webpack.ProvidePlugin({
         'regeneratorRuntime': 'regenerator-runtime', // required for await-async
       })
     ].concat(get(this, 'plugins', []))
   }
 }
开发者ID:easy-webpack,项目名称:config-global-regenerator,代码行数:9,代码来源:index.ts

示例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')] : []) }
       ])
     }
   }
 }
开发者ID:easy-webpack,项目名称:config-tslint,代码行数:9,代码来源:index.ts

示例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')] : []),
       }])
     }
   }
 }
开发者ID:easy-webpack,项目名称:config-html,代码行数:11,代码来源:index.ts

示例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')] : []),
       }])
     }
   }
 }
开发者ID:easy-webpack,项目名称:config-json,代码行数:11,代码来源:index.ts


注:本文中的@easy-webpack/core.get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。