Skip to content

no .d.ts generated #3

@Falieson

Description

@Falieson

When I run nps build it creates a prod build. Looking in /dist there's no declaration file.

My repo is here: https://github.com/TGRstack/typescript-module

There's a lot of config but the relevant bits are:

// common
const outputName = 'index'

module.exports = {
  entry: {
    main: paths.src.entry
  },
  output: {
    path: paths.build._,
    filename: `${outputName}.js`,
    libraryTarget: 'commonjs'
  },
  resolve: {
    extensions: ['.csv', '.ts', '.js', '.json',],
    modules: ['src', 'node_modules'],
  },
  module: {
    rules: [
      typescript.loader,
      // graphql,
      files,
    ],
  },
  plugins: [
    new Dotenv(dotEnvOpts),
    // typescript.paths,
    new TSDeclerationsPlugin({
      main: 'main',
      output: `${outputName}.d.ts`
    }),
  ],
  target: 'node',
  externals: [nodeExternals()],
  node: {
    __dirname: false,
    __filename: false,
  },
}

https://github.com/TGRstack/typescript-module/blob/master/webpack/webpack.prod.js

// webpack prod
const webpackCommon = require('./webpack.common');

module.exports = merge(webpackCommon, {
  mode: 'production',
  devtool: false, // README.md
  bail: true,
  plugins: [
    new TerserPlugin({
      parallel: true,
      terserOptions: {
        ecma: 6,
      },
    }),
  ],
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions