From 68ec8d7f150c454b89960c7f725e92f9898aee4b Mon Sep 17 00:00:00 2001 From: colder Date: Sat, 13 Jun 2020 15:49:54 +0800 Subject: [PATCH] feat: add babel-plugin-import config --- babel.js | 12 ++++++++++++ package.json | 5 +++-- yarn.lock | 8 ++++---- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 babel.js diff --git a/babel.js b/babel.js new file mode 100644 index 0000000..305ec69 --- /dev/null +++ b/babel.js @@ -0,0 +1,12 @@ +const pkg = require('./package.json') + +module.exports = [ + 'import', + { + libraryName: pkg.name, + libraryDirectory: 'dist', + camel2DashComponentName: false, + transformToDefaultImport: false, + }, + 'import ' + pkg.name, +] diff --git a/package.json b/package.json index d06a773..fa4dbcc 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "files": [ "dist", "docs", - "style" + "style", + "babel.js" ], "repository": { "type": "git", @@ -61,7 +62,7 @@ "@types/classnames": "^2.2.10", "@types/lodash": "^4.14.155", "@types/node": "^14.0.13", - "@types/react": "^16.9.35", + "@types/react": "^16.9.36", "@types/react-is": "^16.7.1", "husky": "^4.2.5", "np": "^6.2.4", diff --git a/yarn.lock b/yarn.lock index 13d83a4..5276e33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -357,10 +357,10 @@ "@types/prop-types" "*" csstype "^2.2.0" -"@types/react@^16.9.35": - version "16.9.35" - resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.9.35.tgz?cache=0&sync_timestamp=1589187921077&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Freact%2Fdownload%2F%40types%2Freact-16.9.35.tgz#a0830d172e8aadd9bd41709ba2281a3124bbd368" - integrity sha1-oIMNFy6Krdm9QXCboigaMSS702g= +"@types/react@^16.9.36": + version "16.9.36" + resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.9.36.tgz?cache=0&sync_timestamp=1591784815359&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Freact%2Fdownload%2F%40types%2Freact-16.9.36.tgz#ade589ff51e2a903e34ee4669e05dbfa0c1ce849" + integrity sha1-reWJ/1HiqQPjTuRmngXb+gwc6Ek= dependencies: "@types/prop-types" "*" csstype "^2.2.0"