mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 20:11:38 +08:00
Fixed: 1293772 Change-Id: I0c12c27c66fcab491fac6869f282b3059e16ee9b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3439239 Auto-Submit: Takuto Ikuta <tikuta@chromium.org> Reviewed-by: Tim Van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
// Copyright 2022 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.
|
|
|
|
// @ts-check
|
|
|
|
const path = require('path');
|
|
|
|
const devtools_paths = require('../devtools_paths.js');
|
|
const devtools_plugin = require('./devtools_plugin.js');
|
|
|
|
// esbuild module uses binary in this path.
|
|
process.env.ESBUILD_BINARY_PATH = path.join(devtools_paths.devtoolsRootPath(), 'third_party', 'esbuild', 'esbuild');
|
|
|
|
const entryPoints = [process.argv[2]];
|
|
const outfile = process.argv[3];
|
|
|
|
const outdir = path.dirname(outfile);
|
|
|
|
const plugin = {
|
|
name: 'devtools-plugin',
|
|
setup(build) {
|
|
// https://esbuild.github.io/plugins/#on-resolve
|
|
build.onResolve({filter: /.*/}, devtools_plugin.esbuildPlugin(outdir));
|
|
},
|
|
};
|
|
|
|
require('esbuild')
|
|
.build({
|
|
entryPoints,
|
|
outfile,
|
|
bundle: true,
|
|
format: 'esm',
|
|
platform: 'browser',
|
|
plugins: [plugin],
|
|
})
|
|
.catch(err => {
|
|
console.error('failed to run esbuild:', err);
|
|
process.exit(1);
|
|
});
|