diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc821fb..4bc288a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,8 +23,10 @@ jobs: - name: Build run: | npm install - npm run release - zip -r -j static.zip dist/* + npm run release:minified + zip -r -j static_minified.zip dist/* + npm run release:unminified + zip -r -j static_unminified.zip dist/* - name: Get version run: echo "::set-output name=version::v$(./ci/getVersion.sh)" diff --git a/package.json b/package.json index dbce38d..0b066ca 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "clean": "shx rm -rf ./dist", "build": "npm run clean && cross-env webpack", "release:minified": "npm run clean && NODE_ENV=production MINIFY=true cross-env webpack", + "release:unminified": "npm run clean && NODE_ENV=production MINIFY=false cross-env webpack", "preview": "cross-env webpack server", "lint:js": "eslint ./src ./webpack ./*.js -f table --ext .js --ext .jsx", "lint:scss": "stylelint ./src/**/*.scss --syntax scss", diff --git a/webpack/config.js b/webpack/config.js index a62265e..007dacf 100755 --- a/webpack/config.js +++ b/webpack/config.js @@ -15,11 +15,11 @@ // --------------------- const - path = require('path'), - manifest = require('./manifest'), + path = require('path'), + manifest = require('./manifest'), devServer = require('./devServer'), - rules = require('./rules'), - plugins = require('./plugins'); + rules = require('./rules'), + plugins = require('./plugins'); const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin"); @@ -46,22 +46,20 @@ const resolve = { ], }; -let optimization = {}; +const optimization = { + minimize: manifest.MINIFY +}; if (manifest.MINIFY) { - optimization = { - minimize: manifest.MINIFY, - minimizer: [ - new CssMinimizerPlugin(), - new TerserPlugin() - ], - }; + optimization.minimizer = [ + new CssMinimizerPlugin(), + new TerserPlugin() + ]; } // ----------------- // @Exporting Module // ----------------- - module.exports = { devtool: manifest.IS_PRODUCTION ? false : 'source-map', context: path.join(manifest.paths.src, manifest.entries.js), diff --git a/webpack/manifest.js b/webpack/manifest.js index 15005c7..6e0c8f0 100755 --- a/webpack/manifest.js +++ b/webpack/manifest.js @@ -28,7 +28,7 @@ const NODE_ENV = process.env.NODE_ENV || 'development', IS_DEVELOPMENT = NODE_ENV === 'development', IS_PRODUCTION = NODE_ENV === 'production', - MINIFY = process.env.MINIFY === 'true' || IS_PRODUCTION; + MINIFY = process.env.MINIFY === 'true'; // ------ // @Utils diff --git a/webpack/rules/sass.js b/webpack/rules/sass.js index d98086c..53b0321 100755 --- a/webpack/rules/sass.js +++ b/webpack/rules/sass.js @@ -27,8 +27,7 @@ const loaders = [ { loader: 'css-loader', options: { - sourceMap : manifest.IS_DEVELOPMENT, - // minimize : manifest.IS_PRODUCTION, + sourceMap : manifest.IS_DEVELOPMENT }, }, {