Skip to content

Commit 624b77d

Browse files
committed
打包成可用组件
1 parent a61504a commit 624b77d

File tree

12 files changed

+82
-62
lines changed

12 files changed

+82
-62
lines changed

lib.webpack.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
entry: './src/components/index.js',
5+
output: {
6+
filename: 'map-viz.js',
7+
path: path.join(__dirname, '/lib/')
8+
},
9+
resolve: {
10+
extensions: ['.ts', '.tsx', '.js', '.css', '.json']
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.tsx?$/,
16+
use: ['awesome-typescript-loader']
17+
},
18+
{
19+
test: /\.ts?$/,
20+
use: ['awesome-typescript-loader']
21+
},
22+
{
23+
test: /\.css$/,
24+
use: ['style-loader', 'css-loader']
25+
},
26+
{
27+
test: /\.json$/,
28+
use: ['json-loader']
29+
}
30+
]
31+
}
32+
};

lib/map-viz.js

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"name": "map-viz-for-react",
2+
"name": "wuhan2020-map-viz",
33
"version": "0.1.0",
4-
"private": true,
4+
"description": "map visualization components for wuhan 2020",
5+
"repository": "wuhan2020/map-viz",
6+
"license": "MIT",
7+
"keywords": [
8+
"wuhan2020"
9+
],
10+
"author": "shadowings-zy",
511
"dependencies": {
612
"@testing-library/jest-dom": "^4.2.4",
713
"@testing-library/react": "^9.3.2",
@@ -18,11 +24,22 @@
1824
"react-scripts": "3.3.1",
1925
"typescript": "~3.7.2"
2026
},
27+
"devDependencies": {
28+
"@babel/core": "^7.8.4",
29+
"awesome-typescript-loader": "^5.2.1",
30+
"browserslist": "^4.8.6",
31+
"css-loader": "^3.4.2",
32+
"json-loader": "^0.5.7",
33+
"style-loader": "^1.1.3",
34+
"webpack": "^4.41.5",
35+
"webpack-cli": "^3.3.10"
36+
},
2137
"scripts": {
2238
"start": "react-scripts start",
2339
"build": "react-scripts build",
2440
"test": "react-scripts test",
25-
"eject": "react-scripts eject"
41+
"eject": "react-scripts eject",
42+
"lib": "npx webpack --config lib.webpack.config.js"
2643
},
2744
"eslintConfig": {
2845
"extends": "react-app"

src/components/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { HierarchicalVirusMap } from './virusMap/hierarchicalVirusMap';
2+
import { InformationMap } from './informationMap/informationMap';
3+
4+
export {
5+
HierarchicalVirusMap,
6+
InformationMap
7+
}

src/components/informationMap/informationMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import React from 'react';
99
import { BaiduMap } from './baiduMap';
10-
import markerIcon from './marker.json';
10+
import markerIcon from './marker';
1111
import './style.css';
1212

1313
type InquiryMeta = [string, number | string | boolean];

src/components/informationMap/marker.json renamed to src/components/informationMap/marker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
export default {
22
"hospital": "http://i2.tiimg.com/708620/f869afffd7f03d19.png",
33
"hotel": "http://i2.tiimg.com/708620/ad73337602f2cc9b.png",
44
"others": "http://i2.tiimg.com/708620/15e58afc32dfc7bf.png"

src/components/virusMap/virusChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import React from 'react';
1313
import { ReactEcharts } from './reactEcharts';
14-
import provinceName from '../../data/isaaclin/provinces.json';
14+
import provinceName from '../../data/map/provinces';
1515

1616
type Props = {
1717
data: any;

src/components/virusMap/virusMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import React from 'react';
1818
import { EchartsMap } from './echartsMap';
1919
import { VirusChart } from './virusChart';
20-
import mapUrls from '../../data/map/mapDict.json';
20+
import mapUrls from '../../data/map/district';
2121
import './style.css';
2222

2323
type MapDataType = {

src/data/map/mapDict.json renamed to src/data/map/district.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
export default {
22
"中国": "https://map-1252957949.cos.ap-guangzhou.myqcloud.com/china.json",
33
"世界": "https://map-1252957949.cos.ap-guangzhou.myqcloud.com/world.json",
44
"安徽": "https://map-1252957949.cos.ap-guangzhou.myqcloud.com/china/anhui.json",

src/data/map/mapList.json

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)