當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。