forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
35 lines (32 loc) · 855 Bytes
/
rollup.config.js
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
'use strict';
const fs = require('fs');
const path = require('path');
module.exports = {
input: 'dist/es/ember/index.js',
plugins: [emberPackage()],
output: {
file: 'rollup-bundle.es.js',
format: 'iife',
name: '__Ember',
named: true,
sourcemap: true,
},
};
function emberPackage() {
return {
resolveId(importee, importer) {
if (importee[0] === '.' || importee[0] === '/') return;
let resolved = [
path.resolve('dist', `es/${importee}.js`),
path.resolve('dist', `es/${importee}/index.js`),
].find(fs.existsSync);
if (resolved) {
// console.log('resolved ' + resolved);
return fs.realpathSync(resolved);
} else {
// eslint-disable-next-line no-console
console.log('could not resolve ' + importee + ' from ' + importer);
}
},
};
}