1 | let dynamicImport
|
2 | try {
|
3 | dynamicImport = require('./esm').dynamicImport
|
4 | } catch (_err) {
|
5 | // Ignore since syntax is not supported in this environment
|
6 | }
|
7 |
|
8 | function onError (err) {
|
9 | throw err /* ↓ Check stack trace ↓ */
|
10 | }
|
11 |
|
12 | module.exports = function (filename, opts) {
|
13 | require('../dist/v8cache')
|
14 | const jiti = require('../dist/jiti')
|
15 |
|
16 | opts = { dynamicImport, onError, ...opts }
|
17 |
|
18 | if (!opts.transform) {
|
19 | opts.transform = require('../dist/babel')
|
20 | }
|
21 |
|
22 | return jiti(filename, opts)
|
23 | }
|