@cocreate/mongodb 1.0.0

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.
@@ -0,0 +1,85 @@
1
+ const path = require("path")
2
+ const TerserPlugin = require("terser-webpack-plugin")
3
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
+ let isProduction = process.env.NODE_ENV === "production"
5
+ const { CleanWebpackPlugin } = require("clean-webpack-plugin")
6
+
7
+ module.exports = {
8
+ entry: {
9
+ "CoCreate-mongodb": "./src/index.js",
10
+ },
11
+ output: {
12
+ path: path.resolve(__dirname, "dist"),
13
+ filename: isProduction ? "[name].min.js" : "[name].js",
14
+ libraryTarget: "umd",
15
+ libraryExport: "default",
16
+ library: ["CoCreate", "mongodb"],
17
+ globalObject: "this",
18
+ // publicPath: 'https://server.cocreate.app/CoCreateJS/dist/'
19
+ },
20
+
21
+ plugins: [
22
+ new CleanWebpackPlugin(),
23
+ new MiniCssExtractPlugin({
24
+ filename: "[name].css",
25
+ }),
26
+ ],
27
+ // Default mode for Webpack is production.
28
+ // Depending on mode Webpack will apply different things
29
+ // on final bundle. For now we don't need production's JavaScript
30
+ // minifying and other thing so let's set mode to development
31
+ mode: isProduction ? "production" : "development",
32
+ module: {
33
+ rules: [
34
+ {
35
+ test: /.js$/,
36
+ exclude: /(node_modules)/,
37
+ use: {
38
+ loader: "babel-loader",
39
+ options: {
40
+ plugins: ["@babel/plugin-transform-modules-commonjs"],
41
+ },
42
+ },
43
+ },
44
+ {
45
+ test: /.css$/i,
46
+ use: [
47
+ { loader: "style-loader", options: { injectType: "linkTag" } },
48
+ "file-loader",
49
+ ],
50
+ },
51
+ ],
52
+ },
53
+
54
+ // add source map
55
+ ...(isProduction ? {} : { devtool: "eval-source-map" }),
56
+
57
+ optimization: {
58
+ minimize: true,
59
+ minimizer: [
60
+ new TerserPlugin({
61
+ extractComments: true,
62
+ // cache: true,
63
+ parallel: true,
64
+ // sourceMap: true, // Must be set to true if using source-maps in production
65
+ terserOptions: {
66
+ // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
67
+ // extractComments: 'all',
68
+ compress: {
69
+ drop_console: true,
70
+ },
71
+ },
72
+ }),
73
+ ],
74
+ splitChunks: {
75
+ chunks: "all",
76
+ minSize: 200,
77
+ // maxSize: 99999,
78
+ //minChunks: 1,
79
+
80
+ cacheGroups: {
81
+ defaultVendors: false,
82
+ },
83
+ },
84
+ },
85
+ }