UNPKG

1.84 kBJavaScriptView Raw
1import * as path from 'path';
2import { nodeResolve } from '@rollup/plugin-node-resolve';
3
4const baseTestOutput = path.join(__dirname, 'test', 'assets');
5const noStrict = {
6 renderChunk(code) {
7 return code.replace("'use strict';", '');
8 }
9};
10
11export default [
12 {
13 input: 'src/wbWombat.js',
14 output: {
15 name: 'wombat',
16 file: path.join(baseTestOutput, 'wombat.js'),
17 sourcemap: false,
18 format: 'iife'
19 },
20 plugins: [noStrict, nodeResolve()]
21 },
22 {
23 input: 'src/wbWombatProxyMode.js',
24 output: {
25 name: 'wombat',
26 file: path.join(baseTestOutput, 'wombatProxyMode.js'),
27 sourcemap: false,
28 format: 'iife'
29 },
30 plugins: [noStrict]
31 },
32 {
33 input: 'src/wombatWorkers.js',
34 output: {
35 name: 'wombat',
36 file: path.join(baseTestOutput, 'wombatWorkers.js'),
37 format: 'es',
38 sourcemap: false,
39 exports: 'none'
40 },
41 plugins: [noStrict]
42 },
43 {
44 input: 'src/autoFetchWorker.js',
45 output: {
46 name: 'autoFetchWorker',
47 file: path.join(baseTestOutput, 'autoFetchWorker.js'),
48 format: 'es',
49 sourcemap: false,
50 exports: 'none'
51 },
52 plugins: [
53 {
54 renderChunk(code) {
55 if (!code.startsWith("'use strict';")) {
56 return "'use strict';\n" + code;
57 }
58 return code;
59 }
60 }
61 ]
62 },
63 {
64 input: 'src/wbWombat.js',
65 output: {
66 name: 'wombat',
67 file: path.join(baseTestOutput, 'wombatDirect.js'),
68 sourcemap: false,
69 format: 'es'
70 },
71 plugins: [
72 noStrict,
73 nodeResolve(),
74 {
75 renderChunk(code) {
76 return code.replace(
77 /(this\._wb_wombat\.actual\s=\strue;)/gi,
78 `this._wb_wombat.actual = true;
79 this.wombat = wombat;`
80 );
81 }
82 }
83 ]
84 }
85];