forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (34 loc) · 1.11 KB
/
index.js
File metadata and controls
42 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import babelTranspiler from '../../transpilers/babel';
import jsonTranspiler from '../../transpilers/json';
import rawTranspiler from '../../transpilers/raw';
import stencilTranspiler from '../../transpilers/stencil';
import Preset from '..';
const babelOptions = {
isV7: true,
config: {
presets: [],
plugins: ['@babel/plugin-syntax-import-meta'],
parserOpts: {
plugins: ['dynamicImport', 'objectRestSpread', 'importMeta'],
},
},
};
export default function initialize() {
const stencilPreset = new Preset(
'stencil',
['js', 'ts', 'jsx', 'tsx', 'mjs'],
{}
);
stencilPreset.registerTranspiler(module => /\.(t|j)sx?$/.test(module.path), [
{ transpiler: stencilTranspiler },
]);
stencilPreset.registerTranspiler(module => /\.mjs$/.test(module.path), [
{ transpiler: stencilTranspiler },
{ transpiler: babelTranspiler, options: babelOptions },
]);
stencilPreset.registerTranspiler(module => /\.json$/.test(module.path), [
{ transpiler: jsonTranspiler },
]);
stencilPreset.registerTranspiler(() => true, [{ transpiler: rawTranspiler }]);
return stencilPreset;
}