@s-ui/bundler 8.0.0-beta.4 → 8.0.0-beta.8

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.
@@ -6,7 +6,6 @@ const path = require('path')
6
6
  const program = require('commander')
7
7
  const rimraf = require('rimraf')
8
8
  const webpack = require('webpack')
9
- const {minify} = require('terser')
10
9
  const {writeFile} = require('@s-ui/helpers/file')
11
10
 
12
11
  const config = require('../webpack.config.prod')
@@ -39,9 +38,13 @@ program
39
38
  })
40
39
  .parse(process.argv)
41
40
 
42
- const {clean = false, context} = program
41
+ const {
42
+ clean = false,
43
+ context,
44
+ linkPackage: packagesToLink = []
45
+ } = program.opts()
46
+
43
47
  config.context = context || config.context
44
- const packagesToLink = program.linkPackage || []
45
48
 
46
49
  const nextConfig = packagesToLink.length
47
50
  ? linkLoaderConfigBuilder({
@@ -72,7 +75,6 @@ webpack(nextConfig).run(async (error, stats) => {
72
75
  if (stats.hasWarnings()) {
73
76
  const jsonStats = stats.toJson('errors-warnings')
74
77
  log.warn('Webpack generated the following warnings: ')
75
- log.warn(jsonStats.warnings)
76
78
  jsonStats.warnings.map(({message}) => log.warn(message))
77
79
  }
78
80
 
@@ -133,10 +135,9 @@ webpack(nextConfig).run(async (error, stats) => {
133
135
  JSON.stringify(staticsCacheOnly)
134
136
  )
135
137
 
136
- const {code: minifiedSw} = await minify(swCode, {sourceMap: false})
137
138
  const swFilePath = resolvePublicFile('service-worker.js')
138
139
 
139
- await writeFile(swFilePath, minifiedSw)
140
+ await writeFile(swFilePath, swCode)
140
141
  console.log('\nService worker generated succesfully!\n')
141
142
  }
142
143
 
@@ -59,13 +59,14 @@ if (!module.parent) {
59
59
  })
60
60
  .parse(process.argv)
61
61
 
62
- const {context} = program
62
+ const {context} = program.opts()
63
+
63
64
  webpackConfig.context = context || webpackConfig.context
64
65
  }
65
66
 
66
67
  const start = async ({
67
68
  config = webpackConfig,
68
- packagesToLink = program.linkPackage || []
69
+ packagesToLink = program.opts().linkPackage || []
69
70
  } = {}) => {
70
71
  clearConsole()
71
72
  // Warn and crash if required files are missing
@@ -85,7 +86,7 @@ const start = async ({
85
86
  const urls = prepareUrls(protocol, HOST, port)
86
87
  const nextConfig = linkLoaderConfigBuilder({
87
88
  config,
88
- linkAll: program.linkAll,
89
+ linkAll: program.opts().linkAll,
89
90
  packagesToLink
90
91
  })
91
92
  const compiler = createCompiler(nextConfig, urls)
@@ -35,7 +35,7 @@ const {
35
35
  path: publicPath,
36
36
  args: [entry],
37
37
  root = false
38
- } = program
38
+ } = program.opts()
39
39
 
40
40
  if (!output) {
41
41
  showError(new Error('--output is mandatory.'), program)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "8.0.0-beta.4",
3
+ "version": "8.0.0-beta.8",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
@@ -29,11 +29,11 @@
29
29
  "babel-preset-sui": "3",
30
30
  "commander": "8.3.0",
31
31
  "css-loader": "6.5.1",
32
- "css-minimizer-webpack-plugin": "3.1.3",
32
+ "css-minimizer-webpack-plugin": "3.1.4",
33
33
  "esbuild-loader": "2.16.0",
34
34
  "fast-glob": "3.2.7",
35
35
  "html-webpack-plugin": "5.5.0",
36
- "mini-css-extract-plugin": "2.4.4",
36
+ "mini-css-extract-plugin": "2.4.5",
37
37
  "process": "0.11.10",
38
38
  "postcss": "8.3.11",
39
39
  "postcss-loader": "6.2.0",
@@ -47,7 +47,12 @@ const webpackConfig = {
47
47
  resolve: {
48
48
  alias: {...aliasFromConfig},
49
49
  extensions: ['.js', '.json'],
50
- modules: ['node_modules', path.resolve(process.cwd())]
50
+ modules: ['node_modules', path.resolve(process.cwd())],
51
+ fallback: {
52
+ assert: false,
53
+ fs: false,
54
+ path: false
55
+ }
51
56
  },
52
57
  entry: MAIN_ENTRY_POINT,
53
58
  output: {