flegall / monopack

A JavaScript bundler for node.js monorepo-codebased applications.
MIT License
54 stars 2 forks source link

Implement typescript support #64

Open flegall opened 6 years ago

bradstewart commented 6 years ago

For what it's worth, this monopack.config.js file seems to be working for TypeScript code:

const merge = require('webpack-merge')

module.exports = {
  webpackConfigModifier: (defaultConfig) => {
    return merge(defaultConfig, {
      module: {
        rules: [
          {
            test: /\.ts$/,
            loader: 'ts-loader',
          }
        ]
      },

      resolve: {
        extensions: [ '.ts', 'js' ],
      },
      stats: {
        // suppress "export not found" warnings about re-exported types
        warningsFilter: /export .* was not found in/
      },
    })
  }
}

Should probably use fork-ts-checker-webpack-plugin to speed things up a bit, but the above works as a starting point.

flegall commented 6 years ago

Nice ! :)

murbanowicz commented 5 years ago

I am trying to implement this, but I am getting error:

=>> monopack will resolve dependencies
=>> Undeclared dependencies
    @types/graphql from /home/marek/dev...

Any idea?

flegall commented 5 years ago

Hi,

Sorry for the late reply, thanks for contributing !

Are you trying to implement the feature ? or using it as @bradstewart suggested ?

This warning tells you that you see to be have an undeclared dependency used somewhere : Either : a dependency actually imported or required() or a peer dependency within your dependencies.