blob: d6389d2c8fbf9e449c103eb183ac2caf3106ca6a [file] [log] [blame]
Primiano Tucci94c47f02019-12-05 03:13:11 +00001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Hector Dearmanb06d4152018-05-31 16:55:04 +010015import commonjs from 'rollup-plugin-commonjs';
16import nodeResolve from 'rollup-plugin-node-resolve';
17
18export default {
Hector Dearman03f962c2018-08-09 17:00:32 +010019 output: {name: 'perfetto'},
Hector Dearman1ed33e62019-08-05 11:59:03 +010020 plugins:
21 [
22 nodeResolve({
23 mainFields: ['browser'],
24 browser: true,
Nicolò Mazzucatoff514672019-08-08 12:00:32 +010025 preferBuiltins: false,
Hector Dearman1ed33e62019-08-05 11:59:03 +010026 }),
Hector Dearman21fa9162018-06-22 14:50:29 +010027
Hector Dearman1ed33e62019-08-05 11:59:03 +010028 // emscripten conditionally executes require('fs') (likewise for
29 // others), when running under node. Rollup can't find those libraries
30 // so expects these to be present in the global scope, which then fails
31 // at runtime. To avoid this we ignore require('fs') and the like.
32 commonjs({
33 ignore: [
34 'fs',
35 'path',
36 'crypto',
37 ]
38 }),
Nicolò Mazzucatoff514672019-08-08 12:00:32 +010039 ],
Hector Dearmanb06d4152018-05-31 16:55:04 +010040}