Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quramy/loadable-ts-transformer
TypeScript custom transformer for loadable-components SSR
https://github.com/quramy/loadable-ts-transformer
loadable-components react typescript webpack
Last synced: 29 days ago
JSON representation
TypeScript custom transformer for loadable-components SSR
- Host: GitHub
- URL: https://github.com/quramy/loadable-ts-transformer
- Owner: Quramy
- License: mit
- Created: 2019-11-03T11:13:56.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-26T14:48:40.000Z (8 months ago)
- Last Synced: 2024-10-05T14:03:45.945Z (about 1 month ago)
- Topics: loadable-components, react, typescript, webpack
- Language: TypeScript
- Size: 643 KB
- Stars: 26
- Watchers: 3
- Forks: 4
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](https://github.com/Quramy/loadable-ts-transformer/workflows/build/badge.svg)
# loadable-ts-transformerA TypeScript custom transformer for server side rendering with [loadable-components](https://github.com/smooth-code/loadable-components) .
## Usage
First of all, you should read https://www.smooth-code.com/open-source/loadable-components/docs/server-side-rendering/ .
This transformer is an alternative option for ts-loader user. It works as well as `@loadable/babel-plugin` does.
### Install
```sh
$ npm install loadable-ts-transformer ts-loader webpack typescript -D
```### Configure webpack
```js
/* webpack.config.js */
const { loadableTransformer } = require('loadable-ts-transformer');module.exports = {
...
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader',
options: {
getCustomTransformers: () => ({ before: [loadableTransformer] }),
},
},
],
},
...
};
```**Remarks** This transformer compiles `import(...)` expression. So you should set tsconfig `--module` option to "ES2015" or "ESNext".
## License
MIT