@repodog/rollup-config 1.1.9 → 1.2.0-unstable.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/index.cjs +5 -6
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ npm install @repodog/rollup-config --save-dev
|
|
|
16
16
|
|
|
17
17
|
```shell
|
|
18
18
|
# terminal
|
|
19
|
-
npm install @rollup/plugin-
|
|
19
|
+
npm install @rollup/plugin-image @rollup/plugin-json @rollup/plugin-node-resolve @rollup/plugin-terser rollup rollup-plugin-analyzer rollup-plugin-copy rollup-plugin-sourcemaps --save-dev
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
**Rollup uses Babel for code
|
|
22
|
+
**Rollup uses Babel or SWC for code compilation so you will also need to install [`@repodog/babel-config`](../babel-config/README.md) or [`@repodog/swc-config`](../swc-config/README.md) and the relevant dependencies.**
|
|
23
23
|
|
|
24
24
|
## Use package
|
|
25
25
|
|
|
@@ -32,12 +32,29 @@ npm install @rollup/plugin-babel @rollup/plugin-image @rollup/plugin-json @rollu
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
### With Babel
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
// rollup.config.cjs
|
|
39
|
+
const rollupConfig = require('@repodog/rollup-config');
|
|
40
|
+
const babelConfig = require('@repodog/babel-config/rollup');
|
|
41
|
+
const { babel: babelPlugin } = require('@rollup/plugin-babel');
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
...rollupConfig({ compiler: babelPlugin(babelConfig) }),
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### With SWC
|
|
49
|
+
|
|
35
50
|
```javascript
|
|
36
51
|
// rollup.config.cjs
|
|
37
|
-
const
|
|
52
|
+
const rollupConfig = require('@repodog/rollup-config');
|
|
53
|
+
const swcConfig = require('@repodog/swc-config');
|
|
54
|
+
const swcPlugin = require('@rollup/plugin-swc');
|
|
38
55
|
|
|
39
56
|
module.exports = {
|
|
40
|
-
...
|
|
57
|
+
...rollupConfig({ compiler: swcPlugin(swcConfig) }),
|
|
41
58
|
};
|
|
42
59
|
```
|
|
43
60
|
|
|
@@ -51,4 +68,4 @@ Sets `output.format`, directory name within `./dist` output, and the extension o
|
|
|
51
68
|
|
|
52
69
|
When set to `'prod'` or `'production'`, terser mangles and compresses, the bundle analyser runs, and source maps are omitted.
|
|
53
70
|
|
|
54
|
-
**You cam also use the environment variables outlined in [`@repodog/babel-config`](../babel-config/README.md#environment-variables) to control what is output.**
|
|
71
|
+
**You cam also use the environment variables outlined in [`@repodog/babel-config`](../babel-config/README.md#environment-variables) or [`@repodog/swc-config`](../swc-config/README.md#environment-variables) to control what is output.**
|
package/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
const { babel } = require('@rollup/plugin-babel');
|
|
3
2
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
4
3
|
const image = require('@rollup/plugin-image');
|
|
5
4
|
const json = require('@rollup/plugin-json');
|
|
@@ -28,6 +27,10 @@ const sourcemapPathTransform = sourcePath => {
|
|
|
28
27
|
module.exports = (config = {}) => {
|
|
29
28
|
const extensions = ['.mjs', '.cjs', '.js', '.jsx', '.json', '.ts', '.tsx'];
|
|
30
29
|
|
|
30
|
+
if (!config.compiler) {
|
|
31
|
+
throw new Error('config.compiler is a required option. Both babel and swc rollup plugins are supported.');
|
|
32
|
+
}
|
|
33
|
+
|
|
31
34
|
const plugins = [
|
|
32
35
|
json(),
|
|
33
36
|
nodeResolve({
|
|
@@ -35,11 +38,7 @@ module.exports = (config = {}) => {
|
|
|
35
38
|
preferBuiltins: true,
|
|
36
39
|
}),
|
|
37
40
|
commonjs(),
|
|
38
|
-
|
|
39
|
-
babelHelpers: 'runtime',
|
|
40
|
-
extensions,
|
|
41
|
-
rootMode: 'upward',
|
|
42
|
-
}),
|
|
41
|
+
config.compiler,
|
|
43
42
|
image(),
|
|
44
43
|
];
|
|
45
44
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repodog/rollup-config",
|
|
3
3
|
"description": "The RepoDog Rollup config module.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0-unstable.0",
|
|
5
5
|
"author": "Dylan Aubrey",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/badbatch/repodog",
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@rollup/plugin-babel": "<7",
|
|
20
19
|
"@rollup/plugin-commonjs": "<26",
|
|
21
20
|
"@rollup/plugin-image": "<4",
|
|
22
21
|
"@rollup/plugin-json": "<7",
|