How to use the ts-loader/package.json.version function in ts-loader

To help you get started, we’ve selected a few ts-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vue-cli / packages / @vue / cli-plugin-typescript / index.js View on Github external
.prepend('.tsx')

    const tsRule = config.module.rule('ts').test(/\.ts$/)
    const tsxRule = config.module.rule('tsx').test(/\.tsx$/)

    // add a loader to both *.ts & vue
    const addLoader = ({ name, loader, options }) => {
      tsRule.use(name).loader(loader).options(options)
      tsxRule.use(name).loader(loader).options(options)
    }

    addLoader({
      name: 'cache-loader',
      loader: require.resolve('cache-loader'),
      options: api.genCacheConfig('ts-loader', {
        'ts-loader': require('ts-loader/package.json').version,
        'typescript': require('typescript/package.json').version,
        modern: !!process.env.VUE_CLI_MODERN_BUILD
      }, 'tsconfig.json')
    })

    if (useThreads) {
      addLoader({
        name: 'thread-loader',
        loader: require.resolve('thread-loader'),
        options:
          typeof projectOptions.parallel === 'number'
            ? { workers: projectOptions.parallel }
            : {}
      })
    }
github Akryum / nodepack / packages / @nodepack / plugin-typescript / src / index.js View on Github external
config.resolveLoader.modules.prepend(path.join(__dirname, 'node_modules'))

    config.resolve
      .extensions
        .merge(['.ts'])

    const tsRule = config.module.rule('ts').test(/\.ts$/)

    const addLoader = ({ loader, options = {}}) => {
      tsRule.use(loader).loader(loader).options(options)
    }

    addLoader({
      loader: 'cache-loader',
      options: api.genCacheConfig('ts-loader', {
        'ts-loader': require('ts-loader/package.json').version,
        'typescript': require('typescript/package.json').version,
      }, 'tsconfig.json'),
    })

    if (useThreads) {
      addLoader({
        loader: 'thread-loader',
      })
    }

    if (api.hasPlugin('babel')) {
      addLoader({
        loader: 'babel-loader',
      })
    }
    addLoader({
github Akryum / nodepack / packages / @nodepack / plugin-typescript / src / index.js View on Github external
config.resolveLoader.modules.prepend(path.join(__dirname, 'node_modules'))

    config.resolve
      .extensions
      .merge(['.ts'])

    const tsRule = config.module.rule('ts').test(/\.ts$/)

    const addLoader = ({ loader, options = {} }) => {
      tsRule.use(loader).loader(loader).options(options)
    }

    addLoader({
      loader: 'cache-loader',
      options: api.genCacheConfig('ts-loader', {
        'ts-loader': require('ts-loader/package.json').version,
        'typescript': require('typescript/package.json').version,
      }, 'tsconfig.json'),
    })

    if (useThreads) {
      addLoader({
        loader: 'thread-loader',
      })
    }

    if (api.hasPlugin('babel')) {
      addLoader({
        loader: 'babel-loader',
      })
    }
    addLoader({