mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Change cli options
This commit is contained in:
parent
bf84be65e1
commit
983839f538
@ -77,8 +77,8 @@ options: [--optimize]
|
||||
|
||||
- **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.
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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 || false,
|
||||
options: {
|
||||
backend: adminBackend,
|
||||
publicPath: addSlash(adminPath),
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user