@ts-plugin/loadable
v1.0.0
Published
TypeScript transform plugin for @loadable/component
Downloads
2
Readme
@ts-plugin/loadable
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/]
},
],
},
}