chart-services 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +7 -0
- package/.eslintrc.json +30 -0
- package/README.md +5 -0
- package/build.sh +17 -0
- package/dist/chart-services.css +706 -0
- package/dist/chart-services.js +10 -0
- package/package.json +47 -0
- package/types/index.d.ts +13 -0
- package/webpack.config.babel.js +106 -0
- package/webpack.config.js +12 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
3
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
4
|
+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
5
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
6
|
+
const webpack = require('webpack');
|
|
7
|
+
|
|
8
|
+
module.exports = (env) => {
|
|
9
|
+
let mode, devtool;
|
|
10
|
+
|
|
11
|
+
const dynamicVendors = {
|
|
12
|
+
exceljs: {
|
|
13
|
+
chunks: 'async',
|
|
14
|
+
test: /node_modules\/exceljs/,
|
|
15
|
+
priority: 10
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const dynamicChunks = Object.keys(dynamicVendors);
|
|
19
|
+
|
|
20
|
+
dynamicChunks.forEach(key => {
|
|
21
|
+
dynamicVendors[key].name = `vendor-${key}`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
let externals = [
|
|
25
|
+
{
|
|
26
|
+
'lodash': {
|
|
27
|
+
commonjs: 'lodash',
|
|
28
|
+
commonjs2: 'lodash',
|
|
29
|
+
amd: 'lodash',
|
|
30
|
+
root: '_'
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
'moment',
|
|
34
|
+
'axios',
|
|
35
|
+
'object-hash',
|
|
36
|
+
'numbro',
|
|
37
|
+
'ohm-js',
|
|
38
|
+
'html2canvas',
|
|
39
|
+
'tippy.js',
|
|
40
|
+
'countup.js',
|
|
41
|
+
'base64-js',
|
|
42
|
+
'file-saver',
|
|
43
|
+
'exceljs/dist/exceljs',
|
|
44
|
+
'ee-library',
|
|
45
|
+
'cboard-chart',
|
|
46
|
+
'cboard-common',
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
if (env.production) {
|
|
50
|
+
mode = 'production';
|
|
51
|
+
devtool = 'none';
|
|
52
|
+
} else {
|
|
53
|
+
mode = 'development';
|
|
54
|
+
devtool = 'cheap-module-source-map';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`mode: ${mode}; devtool: ${devtool}`);
|
|
58
|
+
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
entry: {
|
|
62
|
+
'chart-services': './src/index.js',
|
|
63
|
+
},
|
|
64
|
+
resolve: {
|
|
65
|
+
extensions: ['.js', '.vue', '.json'],
|
|
66
|
+
alias: {
|
|
67
|
+
'@': path.resolve('src')
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
output: {
|
|
71
|
+
publicPath: './',
|
|
72
|
+
path: path.resolve(__dirname, './dist'),
|
|
73
|
+
filename: '[name].js',
|
|
74
|
+
libraryTarget: 'umd',
|
|
75
|
+
globalObject: 'this',
|
|
76
|
+
// libraryExport: 'default',
|
|
77
|
+
library: 'chart-services'
|
|
78
|
+
},
|
|
79
|
+
mode,
|
|
80
|
+
devtool,
|
|
81
|
+
externals,
|
|
82
|
+
module: {
|
|
83
|
+
rules: [
|
|
84
|
+
{
|
|
85
|
+
test: /\.(js)$/,
|
|
86
|
+
exclude: /(node_modules|bower_components)/,
|
|
87
|
+
use: 'babel-loader'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
test: /\.(css|less)$/,
|
|
91
|
+
// exclude: /(node_modules)/,
|
|
92
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'],
|
|
93
|
+
},
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
plugins: [
|
|
97
|
+
new MiniCssExtractPlugin({
|
|
98
|
+
filename: "[name].css",
|
|
99
|
+
}),
|
|
100
|
+
// new BundleAnalyzerPlugin({analyzerPort: 8883, openAnalyzer: false}),
|
|
101
|
+
new CleanWebpackPlugin('dist'),
|
|
102
|
+
// new UglifyJsPlugin({ sourceMap: true }),
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
};
|