@ts-plugin/loadable
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@ts-plugin/loadable

CI

Install

  • pnpm add @ts-plugin/loadable -D
  • yarn add @ts-plugin/loadable -D
  • npm install @ts-plugin/loadable --save-dev

Usage

With webpack

Checkout example for the usage.

Clone this repository and run:

  • yarn install
  • yarn build
  • yarn build:example
  • yarn start

to play with the example.

// webpack.config.js

const { createLoadableNodeTransformer } = require('@ts-plugin/loadable')

module.export = {
  ...
  module: {
+   parser: {
+     javascript: {
+       commonjsMagicComments: true,
+     },
+   },
    rules: [
      {
        test: /\.(j|t)sx?$/,
        use: {
          loader: 'ts-loader',
          /** @type {import('ts-loader').Options} */
          options: {
+           happyPackMode: true,
            compilerOptions: {
+             module: 'esnext',
            },
+           getCustomTransformers: () => ({ before: [createLoadableNodeTransformer(process.env.BUILD_TYPE === 'ssr' ? 'node' : 'web')] }),
          },
        },
        exclude: [/node_modules/]
      },
    ],
  },
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ts-plugin/loadable

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

25.4 kB

Total Files

5

Last publish

Collaborators

  • broooooklyn