Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 843503a

Browse files
committed
styled components babel plugin problem fixed
1 parent c440a3a commit 843503a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

internals/webpack/webpack.dev.babel.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ const webpack = require('webpack');
77
const HtmlWebpackPlugin = require('html-webpack-plugin');
88
const CircularDependencyPlugin = require('circular-dependency-plugin');
99

10+
// 1. import default from the plugin module
11+
const createStyledComponentsTransformer = require('typescript-plugin-styled-components')
12+
.default;
13+
14+
// 2. create a transformer;
15+
// the factory additionally accepts an options object which described below
16+
const styledComponentsTransformer = createStyledComponentsTransformer();
17+
1018
module.exports = require('./webpack.base.babel')({
1119
mode: 'development',
1220

@@ -50,6 +58,9 @@ module.exports = require('./webpack.base.babel')({
5058
options: {
5159
transpileOnly: true, // fork-ts-checker-webpack-plugin is used for type checking
5260
logLevel: 'info',
61+
getCustomTransformers: () => ({
62+
before: [styledComponentsTransformer],
63+
}),
5364
},
5465
},
5566
],

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
"tslint-react": "4.0.0",
200200
"tslint-react-hooks": "^2.2.1",
201201
"typescript": "3.5.1",
202+
"typescript-plugin-styled-components": "^1.4.3",
202203
"url-loader": "2.0.1",
203204
"webpack": "4.35.3",
204205
"webpack-cli": "3.3.5",

0 commit comments

Comments
 (0)