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
39 lines (30 loc) · 1.11 KB
/
index.js
File metadata and controls
39 lines (30 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
import Preset from '..';
import stylesTranspiler from '../../transpilers/style';
import babelTranspiler from '../../transpilers/babel';
import jsonTranspiler from '../../transpilers/json';
import rawTranspiler from '../../transpilers/raw';
import reasonTranspiler from '../../transpilers/reason';
import reasonRemap from './reason-remap';
export default function initialize() {
const preset = new Preset(
'reason',
['web.js', 'js', 're', 'json', 'web.jsx', 'jsx'],
reasonRemap,
{ hasDotEnv: true }
);
preset.registerTranspiler(module => /\.css$/.test(module.path), [
{ transpiler: stylesTranspiler },
]);
preset.registerTranspiler(module => /\.jsx?$/.test(module.path), [
{ transpiler: babelTranspiler },
]);
preset.registerTranspiler(module => /\.json$/.test(module.path), [
{ transpiler: jsonTranspiler },
]);
preset.registerTranspiler(module => /\.re$/.test(module.path), [
{ transpiler: reasonTranspiler },
{ transpiler: babelTranspiler, options: { simpleRequire: true } },
]);
preset.registerTranspiler(() => true, [{ transpiler: rawTranspiler }]);
return preset;
}