From 28ab05512a77e7fc6e7ec1fabcdc41a254bcef88 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Thu, 14 Oct 2021 17:46:19 +0800 Subject: [PATCH] chore(react-component): Fix example error. --- example/react-component/README.md | 50 ---------------------- example/react-component/package.json | 10 ++--- example/react-component/website/App.less | 1 + example/react-component/website/index.html | 2 +- 4 files changed, 7 insertions(+), 56 deletions(-) diff --git a/example/react-component/README.md b/example/react-component/README.md index 840d6c7a..85410a71 100644 --- a/example/react-component/README.md +++ b/example/react-component/README.md @@ -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 } - } - ] - ] - } -} -``` \ No newline at end of file diff --git a/example/react-component/package.json b/example/react-component/package.json index c52c7723..0ad880d8 100644 --- a/example/react-component/package.json +++ b/example/react-component/package.json @@ -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", @@ -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" diff --git a/example/react-component/website/App.less b/example/react-component/website/App.less index 4b488053..7f2559ba 100644 --- a/example/react-component/website/App.less +++ b/example/react-component/website/App.less @@ -6,4 +6,5 @@ html { .warpper { padding: 20px; + color: red; } diff --git a/example/react-component/website/index.html b/example/react-component/website/index.html index e0c5aded..ecd6ff30 100644 --- a/example/react-component/website/index.html +++ b/example/react-component/website/index.html @@ -7,6 +7,6 @@
- +