From b117e21dc4d2ccb8abe1052679531c4d78b415b6 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 6 Aug 2022 22:53:57 +0800 Subject: [PATCH] feat(touch-emulator): support .mjs extension (#10888) --- packages/vant-touch-emulator/build.js | 11 +++++++++++ packages/vant-touch-emulator/changelog.md | 6 ++++++ packages/vant-touch-emulator/package.json | 12 +++++++++--- packages/vant-touch-emulator/{ => src}/index.js | 0 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 packages/vant-touch-emulator/build.js rename packages/vant-touch-emulator/{ => src}/index.js (100%) diff --git a/packages/vant-touch-emulator/build.js b/packages/vant-touch-emulator/build.js new file mode 100644 index 000000000..f28813b81 --- /dev/null +++ b/packages/vant-touch-emulator/build.js @@ -0,0 +1,11 @@ +const fs = require('fs'); +const path = require('path'); + +const srcFile = path.join(__dirname, 'src', 'index.js'); +const distDir = path.join(__dirname, 'dist'); + +if (!fs.existsSync(distDir)) { + fs.mkdirSync(distDir); +} +fs.copyFileSync(srcFile, path.join(distDir, 'index.js')); +fs.copyFileSync(srcFile, path.join(distDir, 'index.mjs')); diff --git a/packages/vant-touch-emulator/changelog.md b/packages/vant-touch-emulator/changelog.md index 69d213800..d112a9e04 100644 --- a/packages/vant-touch-emulator/changelog.md +++ b/packages/vant-touch-emulator/changelog.md @@ -1,5 +1,11 @@ # Changelog +### [v1.4.0] + +`2022-08-06` + +- support `.mjs` extension + ### [v1.3.1] `2021-07-06` diff --git a/packages/vant-touch-emulator/package.json b/packages/vant-touch-emulator/package.json index e4cc08e51..0c1b6a406 100644 --- a/packages/vant-touch-emulator/package.json +++ b/packages/vant-touch-emulator/package.json @@ -1,10 +1,16 @@ { "name": "@vant/touch-emulator", - "version": "1.3.2", + "version": "1.4.0", "description": "Vant touch emulator", - "main": "index.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "scripts": { + "build": "node ./build.js", + "prepare": "pnpm build" + }, "publishConfig": { - "access": "public" + "access": "public", + "registry": "https://registry.npmjs.org/" }, "repository": { "type": "git", diff --git a/packages/vant-touch-emulator/index.js b/packages/vant-touch-emulator/src/index.js similarity index 100% rename from packages/vant-touch-emulator/index.js rename to packages/vant-touch-emulator/src/index.js