@atlascommunity/tsconfig-base

1.1.2 • Public • Published

Atlas Community Base tsconfig

Installation

yarn add --dev @atlascommunity/tsconfig-base

In tsconfig.json add row:

  "extends": "@atlascommunity/tsconfig-base"

Migration from v1.0.9 to v1.1.0

tsconfig.json

  • Remove module and noEmit fields in your tsconfig

webpack.config.js

  • Change the ts-loader to:
{
  test: /\.(ts|tsx)$/,
  use: [{
    loader: 'ts-loader',
    options: { compilerOptions: { noEmit: false } },
  }],
  exclude: /node_modules/,
},
  • Change the css-loader to:
// This will allow you to use regular css import in conjunction with modules
{
  loader: 'css-loader',
    options: {
    esModule: true,
      modules: {
      namedExport: true,
      auto: /\.module\.\w+$/i,
    },
  },
},
  • Add a field after module
// This will prevent unnamed dependency imports
module: {
  strictExportPresence: true,
  // rules { ...
}
  • If you are using modules in your project, add this to your .d.ts file
declare module "*.module.css" {
  const content: Record<string, string>;
  export = content;
}

declare module "*.module.pcss" {
  const content: Record<string, string>;
  export = content;
}

package.json

  • If your package.json uses the sideEffects field, remove it
  • Update your typescript to the latest version (^5.6.*)

New rules for using named module imports

Old import:

import styles from './file.module.css'

New import:

import * as styles from './file.module.css'

Readme

Keywords

none

Package Sidebar

Install

npm i @atlascommunity/tsconfig-base

Weekly Downloads

25

Version

1.1.2

License

MIT

Unpacked Size

3.04 kB

Total Files

4

Last publish

Collaborators

  • a1rth
  • mashintsev