Merge branch 'develop' of github.com:strapi/strapi into front/fix-ctb-issues

This commit is contained in:
soupette 2019-10-15 07:10:02 +02:00
commit 7f747dbbb1
10 changed files with 171 additions and 769 deletions

View File

@ -72,13 +72,13 @@ Builds your admin panel.
```bash
strapi build
options: [--optimize]
options: [--no-optimization]
```
- **strapi build**<br/>
Builds the administration panel without minimizing the assets
- **strapi build --optimize**<br/>
Builds the administration panel and minize the assets. The build duration takes longer
- **strapi build --no-optimization**<br/>
Builds the administration panel without minizing the assets. The build duration is faster.
::: note
You can specify a NODE_ENV to use the configurations in the `./config/environments/[development|staging|production]` folder.

View File

@ -44,7 +44,7 @@ Before running your server in production you need to build your admin panel for
::: tab "yarn" id="yarn-build"
```bash
NODE_ENV=production yarn build --optimize
NODE_ENV=production yarn build
```
:::
@ -52,7 +52,7 @@ NODE_ENV=production yarn build --optimize
::: tab "npm" id="npm-build"
```bash
NODE_ENV=production npm run build --optimize
NODE_ENV=production npm run build
```
:::

View File

@ -196,10 +196,3 @@ export { dispatch };
if (window.Cypress) {
window.__store__ = Object.assign(window.__store__ || {}, { store });
}
// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
if (NODE_ENV === 'production') {
require('offline-plugin/runtime').install(); // eslint-disable-line global-require
}

View File

@ -27,6 +27,7 @@
"bcryptjs": "^2.4.3",
"bootstrap": "^4.3.1",
"chalk": "^2.4.2",
"chokidar": "^3.2.1",
"classnames": "^2.2.6",
"cross-env": "^5.0.5",
"css-loader": "^2.1.1",
@ -47,9 +48,6 @@
"mini-css-extract-plugin": "^0.6.0",
"moment": "^2.24.0",
"open-browser-webpack-plugin": "^0.0.5",
"postcss-loader": "^3.0.0",
"postcss-smart-import": "^0.7.6",
"precss": "^4.0.0",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-copy-to-clipboard": "^5.0.1",
@ -71,7 +69,6 @@
"remove-markdown": "^0.2.2",
"reselect": "^3.0.1",
"sanitize.css": "^4.1.0",
"sass-loader": "^7.1.0",
"shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.16.8",
"strapi-utils": "3.0.0-beta.16.8",
@ -81,6 +78,8 @@
"url-loader": "^1.1.2",
"video-react": "^0.13.2",
"webpack": "^4.40.1",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1",
"webpackbar": "^3.2.0",
"yup": "^0.27.0"
},
@ -102,12 +101,5 @@
},
"license": "MIT",
"gitHead": "c85658a19b8fef0f3164c19693a45db305dc07a9",
"devDependencies": {
"chokidar": "^3.1.1",
"compression-webpack-plugin": "^3.0.0",
"offline-plugin": "^5.0.7",
"webpack": "^4.40.1",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1"
}
"devDependencies": {}
}

View File

@ -1,7 +0,0 @@
const postcssSmartImport = require('postcss-smart-import');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
module.exports = {
plugins: [postcssSmartImport(), precss(), autoprefixer()],
};

View File

@ -9,8 +9,6 @@ const DuplicatePckgChecker = require('duplicate-package-checker-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const WebpackBar = require('webpackbar');
const isWsl = require('is-wsl');
const OfflinePlugin = require('offline-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const alias = require('./webpack.alias.js');
// TODO: parametrize
@ -40,27 +38,6 @@ module.exports = ({
chunkFilename: '[name].[chunkhash].chunkhash.css',
ignoreOrder: true,
}),
new OfflinePlugin({
relativePaths: false,
publicPath: options.publicPath,
appShell: '/',
// No need to cache .htaccess. See http://mxs.is/googmp,
// this is applied before any match in `caches` section
excludes: ['.htaccess'],
caches: {
main: [':rest:'],
// All chunks marked as `additional`, loaded after main section
// and do not prevent SW to install. Change to `optional` if
// do not want them to be preloaded at all (cached only when first loaded)
additional: ['*.chunk.js'],
},
// Removes warning for about `additional` section usage
safeToUseOptionalCaches: true,
}),
new WebpackBar(),
]
: [
@ -72,17 +49,6 @@ module.exports = ({
}),
];
if (optimize && isProduction) {
webpackPlugins.push(
new CompressionPlugin({
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8,
})
);
}
return {
mode: isProduction ? 'production' : 'development',
bail: isProduction ? true : false,

View File

@ -176,8 +176,8 @@ program
program
.command('build')
.option(
'--optimize',
'Build the Administration with assets optimization',
'--no-optimization',
'Build the Administration without assets optimization',
false
)
.description('Builds the strapi admin app')

View File

@ -10,7 +10,7 @@ const addSlash = require('../utils/addSlash');
/**
* `$ strapi build`
*/
module.exports = async ({ optimize }) => {
module.exports = async ({ optimization }) => {
const dir = process.cwd();
const env = process.env.NODE_ENV || 'development';
@ -39,7 +39,7 @@ module.exports = async ({ optimize }) => {
dir,
// front end build env is always production for now
env: 'production',
optimize: optimize || false,
optimize: optimization,
options: {
backend: adminBackend,
publicPath: addSlash(adminPath),

View File

@ -20,7 +20,7 @@ module.exports = async function({ build, watchAdmin }) {
// Don't run the build process if the admin is in watch mode
if (build && !watchAdmin && !fs.existsSync(path.join(dir, 'build'))) {
try {
execa.shellSync('npm run -s build', {
execa.shellSync('npm run -s build -- --no-optimization', {
stdio: 'inherit',
});
} catch (err) {

856
yarn.lock

File diff suppressed because it is too large Load Diff