• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript core.get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript auth.service.AuthService类代码示例发布时间:2022-05-28
下一篇:
TypeScript config-css.config-css函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap