Skip to content

Commit

Permalink
chore(react-component): Fix example error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 14, 2021
1 parent a4b96aa commit 28ab055
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 56 deletions.
50 changes: 0 additions & 50 deletions example/react-component/README.md
Expand Up @@ -9,53 +9,3 @@ npm run start
```

The components are placed in the `src` directory.

## babel

If `--target=react`, the babel environment(`--env-name=esm:dev`) variable supports development mode.

```json
{
"scripts": {
"watch": "tsbb watch --target react --env-name esm:dev"
}
}
```

Babel configuration example:

```json
{
"env": {
"cjs": {
"plugins": [
[
"babel-plugin-transform-remove-imports",
{ "test": "(less|css)$" }
]
]
},
"esm": {
"plugins": [
[
"babel-plugin-transform-rename-import",
{ "original": "^(.+?)\\.less$", "replacement": "$1.css" }
]
]
},
"esm:dev": {
"presets": [
[
"@tsbb/babel-preset-tsbb",
{
"modules": false,
"targets": {
"browsers": [ "last 2 versions" ]
},
"transformRuntime": { "useESModules": true }
}
]
]
}
}
```
10 changes: 5 additions & 5 deletions example/react-component/package.json
Expand Up @@ -11,8 +11,8 @@
"css:build:dist": "compile-less -d src --combine dist/markdown-editor.css --rm-global",
"test": "tsbb test --env=jsdom",
"coverage": "tsbb test --env=jsdom --coverage",
"doc:dev": "parcel watch website/index.html --dist-dir doc --no-cache",
"doc": "parcel build website/index.html --dist-dir doc --public-url ./ --no-cache"
"start": "parcel website/index.html",
"doc": "parcel build website/index.html --dist-dir doc"
},
"repository": {
"type": "git",
Expand All @@ -34,18 +34,18 @@
"@babel/plugin-transform-modules-umd": "7.14.5",
"@babel/plugin-transform-runtime": "7.15.8",
"@babel/runtime": "7.15.4",
"@parcel/transformer-less": "2.0.0-rc.0",
"@parcel/transformer-less": "2.0.0",
"@tsbb/babel-preset-tsbb": "1.14.2",
"babel-plugin-transform-remove-imports": "1.7.0",
"babel-plugin-transform-rename-import": "2.3.0",
"compile-less-cli": "1.8.9",
"less": "4.1.2",
"parcel": "2.0.0-rc.0",
"parcel": "2.0.0",
"react-test-renderer": "17.0.2",
"tsbb": "^3.4.4"
},
"dependencies": {
"@parcel/transformer-react-refresh-wrap": "2.0.0-rc.0",
"@parcel/transformer-react-refresh-wrap": "2.0.0",
"classnames": "2.3.1",
"react": "17.0.2",
"react-dom": "17.0.2"
Expand Down
1 change: 1 addition & 0 deletions example/react-component/website/App.less
Expand Up @@ -6,4 +6,5 @@ html {

.warpper {
padding: 20px;
color: red;
}
2 changes: 1 addition & 1 deletion example/react-component/website/index.html
Expand Up @@ -7,6 +7,6 @@

<body>
<div id="root"></div>
<script src="./App.js" type="module"></script>
<script src="./index.js" type="module"></script>
</body>
</html>

0 comments on commit 28ab055

Please sign in to comment.