Skip to content

Commit d6c8fe9

Browse files
authored
Merge pull request #2 from jaebradley/fix-relative-import
fix(export): fix relative exports
2 parents 6f11538 + 1b6b58d commit d6c8fe9

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

rollup.config.js

+33-24
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,50 @@ import {
99
terser,
1010
} from 'rollup-plugin-terser';
1111

12-
const config = {
13-
input: 'src/index.js',
12+
const plugins = [
13+
globals(),
14+
builtins(),
15+
babel({ exclude: 'node_modules/**' }),
16+
localResolve(),
17+
resolve({
18+
module: true,
19+
jsnext: true,
20+
main: true,
21+
preferBuiltins: true,
22+
browser: true,
23+
modulesOnly: true,
24+
}),
25+
terser(),
26+
commonjs(),
27+
filesize(),
28+
];
29+
30+
const createConfig = filename => ({
31+
input: `src/${filename}.js`,
1432
output: [
1533
{
16-
file: 'build/index.js',
34+
file: `build/${filename}.js`,
1735
format: 'umd',
1836
name: 'example-rollup-library',
1937
},
2038
{
21-
file: 'build/index.cjs.js',
39+
file: `build/${filename}.cjs.js`,
2240
format: 'cjs',
2341
name: 'example-rollup-library',
2442
},
2543
{
26-
file: 'build/index.esm.js',
44+
file: `build/${filename}.esm.js`,
2745
format: 'es',
2846
},
2947
],
30-
plugins: [
31-
globals(),
32-
builtins(),
33-
babel({ exclude: 'node_modules/**' }),
34-
localResolve(),
35-
resolve({
36-
module: true,
37-
jsnext: true,
38-
main: true,
39-
preferBuiltins: true,
40-
browser: true,
41-
modulesOnly: true,
42-
}),
43-
terser(),
44-
commonjs(),
45-
filesize(),
46-
],
47-
};
48+
plugins,
49+
});
50+
51+
const configs = [
52+
'index',
53+
'a',
54+
'b',
55+
'c',
56+
].map(filename => createConfig(filename));
4857

49-
export default config;
58+
export default configs;

0 commit comments

Comments
 (0)