mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
Move rollup configuration to front_end/rollup.config.js
This makes it easier to change the rollup configuration and allows us to introduce the terser minification plugin. R=jacktfranklin@chromium.org,aerotwist@chromium.org Bug: 1084578 Change-Id: Ie9c3447913a9d6ca59905267472a8bad328642b2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2208134 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
ce0a830cd5
commit
11c3e48f98
@@ -0,0 +1,20 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const external = fs.readdirSync(__dirname, {withFileTypes: true})
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => path.join(__dirname, dirent.name, dirent.name + '.js'));
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default {
|
||||
external,
|
||||
treeshake: false,
|
||||
context: 'self',
|
||||
output: {
|
||||
format: 'esm',
|
||||
},
|
||||
};
|
||||
@@ -40,17 +40,6 @@ finally:
|
||||
|
||||
FRONT_END_DIRECTORY = path.join(os.path.dirname(path.abspath(__file__)), '..', '..', 'front_end')
|
||||
|
||||
MODULE_LIST = [
|
||||
path.join(FRONT_END_DIRECTORY, subfolder, subfolder + '.js')
|
||||
for subfolder in os.listdir(FRONT_END_DIRECTORY)
|
||||
if path.isdir(os.path.join(FRONT_END_DIRECTORY, subfolder))
|
||||
]
|
||||
|
||||
ROLLUP_ARGS = [
|
||||
'--no-treeshake', '--format', 'esm', '--context', 'self', '--external',
|
||||
','.join([path.abspath(module) for module in MODULE_LIST])
|
||||
]
|
||||
|
||||
|
||||
def main(argv):
|
||||
try:
|
||||
@@ -221,10 +210,14 @@ class ReleaseBuilder(object):
|
||||
js_entrypoint = join(self.application_dir, module_name, module_name + '.js')
|
||||
out = ''
|
||||
if self.use_rollup:
|
||||
rollup_process = subprocess.Popen(
|
||||
[devtools_paths.node_path(), devtools_paths.rollup_path()] + ROLLUP_ARGS + ['--input', js_entrypoint],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
rollup_process = subprocess.Popen([
|
||||
devtools_paths.node_path(),
|
||||
devtools_paths.rollup_path(), '--config',
|
||||
join(FRONT_END_DIRECTORY, 'rollup.config.js'), '--input',
|
||||
js_entrypoint
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, error = rollup_process.communicate()
|
||||
else:
|
||||
out = read_file(js_entrypoint)
|
||||
|
||||
Reference in New Issue
Block a user