Skip to content

Commit

Permalink
feat: 添加esm的模块输出
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed May 22, 2020
1 parent b9496f7 commit 4d7e0be
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
]
],
"env": {
"esm": {
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"esmodules": true
}
}
]
]
},
"test": {
"presets": [
[
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ coverage/
demos/assets/
dist/
lib/
es/
mocks/
node_modules/
demos/assets/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ typings/
build
dist
lib
es
temp
.DS_Store
.vscode
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"interactive"
],
"main": "lib/index.js",
"module": "lib/index.js",
"browser": "build/f2.js",
"module": "es/index.js",
"browser": "dist/f2.js",
"homepage": "https://github.com/antvis/f2",
"author": "https://github.com/orgs/antvis/people",
"repository": {
Expand Down Expand Up @@ -82,16 +82,18 @@
"site:build": "BABEL_ENV=site npm run site:clean && gatsby build --prefix-paths",
"site:clean": "BABEL_ENV=site gatsby clean",
"site:deploy": "npm run site:build && gh-pages -d public",
"build": "rm -rf build && rm -rf dist && rollup --config",
"build": "npm run build-lib && npm run build-es && npm run build-umd",
"build-lib": "rm -rf lib && babel src --out-dir lib",
"build-es": "rm -rf es && BABEL_ENV=esm babel src --out-dir es",
"build-umd": "rm -rf dist && rollup --config",
"ci": "npm run lint && npm run test",
"coverage": "jest --coverage",
"demos": "electron ./demos/app.js",
"demos-web": "node ./demos/app.js --web --port 2048",
"dev": "npm run watch & DEBUG=app:* npm run demos-web",
"lint": "eslint ./",
"lint-fix": "eslint --fix ./",
"prepublishOnly": "npm run build-lib && npm run build",
"prepublishOnly": "npm run build",
"screenshot": "DEBUG=app:* ./bin/screenshot.js",
"test": "jest",
"test-unit": "jest test/unit",
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default [
output: [
{
name: 'F2',
file: 'build/f2-all.js',
file: 'dist/f2-all.js',
format: 'umd',
exports: 'named'
},
Expand All @@ -33,7 +33,7 @@ export default [
output: [
{
name: 'F2',
file: 'build/f2.js',
file: 'dist/f2.js',
format: 'umd',
exports: 'named'
},
Expand All @@ -52,7 +52,7 @@ export default [
output: [
{
name: 'F2',
file: 'build/f2-simple.js',
file: 'dist/f2-simple.js',
format: 'umd',
exports: 'named'
},
Expand Down

0 comments on commit 4d7e0be

Please sign in to comment.