From 3d4b516683143c6c5758971ea39fc097cb6b0571 Mon Sep 17 00:00:00 2001 From: debater-coder <52619668+debater-coder@users.noreply.github.com> Date: Sun, 10 Jul 2022 18:19:28 +1000 Subject: [PATCH 1/5] Specify that `es2020` is required --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index ff14a5da0..48b8847a3 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,18 @@ Then you can use modules like this: import { Alg } from "cubing/alg"; import { TwistyPlayer } from "cubing/twisty"; ``` +Note that `cubing.js` requires `es2020` or higher. If you are using vite, then you will have to put this in your `vite.config.ts`: +```ts +import {UserConfig} from "vite"; + +const config: UserConfig = { + build: { + target: "es2020" + } +} + +export default config +``` ## Contributing From 0c0dcab92e54249e52f0ec1175d8dd41f56337a9 Mon Sep 17 00:00:00 2001 From: debater-coder <52619668+debater-coder@users.noreply.github.com> Date: Mon, 11 Jul 2022 19:52:28 +1000 Subject: [PATCH 2/5] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 48b8847a3..0072465f9 100644 --- a/README.md +++ b/README.md @@ -38,17 +38,17 @@ Then you can use modules like this: import { Alg } from "cubing/alg"; import { TwistyPlayer } from "cubing/twisty"; ``` -Note that `cubing.js` requires `es2020` or higher. If you are using vite, then you will have to put this in your `vite.config.ts`: -```ts -import {UserConfig} from "vite"; -const config: UserConfig = { +## Using with bundlers + +Note that `cubing.js` requires `es2020` or higher. If you are using a bundler that transpiles your code for compatibility, you must specify a build target of at least `es2020` or higher. For example, if you are using `vite`, put this in your `vite.config.js`: +```js + +export default { build: { target: "es2020" } } - -export default config ``` ## Contributing From b6e59c165f0cf18b9cdd81f9fd785003977ad68f Mon Sep 17 00:00:00 2001 From: debater-coder <52619668+debater-coder@users.noreply.github.com> Date: Mon, 11 Jul 2022 19:52:58 +1000 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0072465f9..4b9022e45 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,9 @@ Note that `cubing.js` requires `es2020` or higher. If you are using a bundler th ```js export default { + // ... build: { + // ... target: "es2020" } } From ab143309585f3751fe8136094deb8cb1544967b6 Mon Sep 17 00:00:00 2001 From: Hamzah Ahmed Date: Tue, 12 Jul 2022 23:22:50 +1000 Subject: [PATCH 4/5] Add section on vite to `index.html` --- docs/cubing/index.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/cubing/index.html b/docs/cubing/index.html index 308f437e1..395f86c8f 100644 --- a/docs/cubing/index.html +++ b/docs/cubing/index.html @@ -130,6 +130,15 @@

npm package

The npm package should work with any modern bundlers and tools. If you are having trouble, make sure your tool is compatible with ES2020 syntax. We recommend using esbuild or tools based on esbuild, and you may find this project template a helpful start.

+
+

Using with Vite

+

+ By default, Vite, an esbuild-based bundler, transpiles code to ES2019. To use the npm package with Vite, add this to your vite.config.js: + + export default {build: {target: "es2020"}} + +

+

Code Experiments

From 690a4d49f7302dab1b17b11322dd37cd2a3a8fe5 Mon Sep 17 00:00:00 2001 From: Hamzah Ahmed Date: Tue, 12 Jul 2022 23:24:18 +1000 Subject: [PATCH 5/5] Remove section on bundlers from `README.md` --- README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/README.md b/README.md index 4b9022e45..ff14a5da0 100644 --- a/README.md +++ b/README.md @@ -39,20 +39,6 @@ import { Alg } from "cubing/alg"; import { TwistyPlayer } from "cubing/twisty"; ``` -## Using with bundlers - -Note that `cubing.js` requires `es2020` or higher. If you are using a bundler that transpiles your code for compatibility, you must specify a build target of at least `es2020` or higher. For example, if you are using `vite`, put this in your `vite.config.js`: -```js - -export default { - // ... - build: { - // ... - target: "es2020" - } -} -``` - ## Contributing If you would like to contribute to the development of `cubing.js`, please refer to our [contribution guidelines](./CONTRIBUTING.md).