@jseeio/jsee 0.2.1

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,94 @@
1
+ const path = require('path')
2
+ const { VueLoaderPlugin } = require('vue-loader') // Support Vue's SFCs
3
+ const TerserPlugin = require('terser-webpack-plugin') // Minimize code
4
+ const webpack = require('webpack')
5
+ const package = require('./package.json')
6
+
7
+ module.exports = (env) => {
8
+ const config = {
9
+ entry: './main.js',
10
+ output: {
11
+ filename: env.RUNTIME ? 'jsee.runtime.js' : 'jsee.js',
12
+ path: path.resolve(__dirname, 'dist'),
13
+ library: {
14
+ type: 'umd',
15
+ name: 'JSEE',
16
+ export: 'default',
17
+ },
18
+ },
19
+ module: {
20
+ rules: [
21
+ {
22
+ test: /\.vue$/,
23
+ loader: 'vue-loader'
24
+ },
25
+ {
26
+ test: /\.js$/,
27
+ loader: 'babel-loader'
28
+ },
29
+ {
30
+ test: /\.html/,
31
+ type: 'asset/source'
32
+ },
33
+ {
34
+ test: /\.css$/,
35
+ use: [
36
+ 'vue-style-loader',
37
+ 'css-loader',
38
+ ]
39
+ },
40
+ {
41
+ test: /worker\.js$/,
42
+ loader: "worker-loader",
43
+ options: {
44
+ inline: 'no-fallback'
45
+ },
46
+ },
47
+ {
48
+ test: /\.scss$/,
49
+ use: [
50
+ 'vue-style-loader',
51
+ 'css-loader',
52
+ 'sass-loader'
53
+ ]
54
+ }
55
+ ]
56
+ },
57
+ plugins: [
58
+ new VueLoaderPlugin(),
59
+ // Replace those values in the code
60
+ new webpack.DefinePlugin({
61
+ 'VERSION': JSON.stringify(package.version),
62
+ 'RUNTIME': JSON.stringify(env.RUNTIME),
63
+ })
64
+ ],
65
+ // Load different versions of vue based on RUNTIME value
66
+ resolve: {
67
+ alias: {
68
+ vue$: env.RUNTIME
69
+ ? 'vue/dist/vue.runtime.esm-bundler.js'
70
+ : 'vue/dist/vue.esm-bundler'
71
+ },
72
+ },
73
+ // Update recommended size limit
74
+ performance: {
75
+ hints: false,
76
+ maxEntrypointSize: 512000,
77
+ maxAssetSize: 512000
78
+ },
79
+ // Remove comments
80
+ optimization: {
81
+ minimize: true,
82
+ minimizer: [new TerserPlugin({
83
+ extractComments: false,
84
+ terserOptions: {
85
+ format: {
86
+ comments: false,
87
+ },
88
+ }
89
+ })],
90
+ }
91
+ }
92
+
93
+ return config
94
+ }