mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Merge "rollup: speed up dev build by bypassing babel and terser plugins"
This commit is contained in:
commit
549539c3b5
|
@ -3,7 +3,7 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"start": "rollup -c --watch",
|
||||
"build": "rollup -c",
|
||||
"build": "rollup -c --environment BUILD:production",
|
||||
"test": "npm run test:lint && npm run test:unit && npm run check-built-assets",
|
||||
"test:lint": "npm run test:lint:styles && npm run test:lint:js && npm run test:lint:i18n",
|
||||
"test:lint:js": "eslint --cache .",
|
||||
|
|
|
@ -5,6 +5,8 @@ const copy = require( 'rollup-plugin-copy' );
|
|||
const babel = require( '@rollup/plugin-babel' );
|
||||
const terser = require( '@rollup/plugin-terser' );
|
||||
|
||||
const isProduction = process.env.BUILD === 'production';
|
||||
|
||||
/**
|
||||
* Mapping of import paths to ResourceLoader module names.
|
||||
* See usage in 'plugins' below for explanation.
|
||||
|
@ -68,6 +70,12 @@ module.exports = [
|
|||
`require("${ alias }")`,
|
||||
`require("${ importAliases[ alias ] }")`
|
||||
);
|
||||
// Yuck, need to do the same with single apostrophes
|
||||
// in the event terser is disabled such as during dev builds.
|
||||
contents = contents.toString().replace(
|
||||
`require('${ alias }')`,
|
||||
`require('${ importAliases[ alias ] }')`
|
||||
);
|
||||
} );
|
||||
return contents;
|
||||
}
|
||||
|
@ -75,9 +83,9 @@ module.exports = [
|
|||
hook: 'writeBundle'
|
||||
} ),
|
||||
|
||||
babel( { babelHelpers: 'bundled' } ),
|
||||
isProduction ? babel( { babelHelpers: 'bundled' } ) : null,
|
||||
|
||||
terser()
|
||||
isProduction ? terser() : null
|
||||
],
|
||||
|
||||
onwarn: ( warning, warn ) => {
|
||||
|
|
Loading…
Reference in a new issue