Skip to content

Commit 4c9afcd

Browse files
committed
build(rollup): set module resolving and packages excluded
set preferBuiltins to true and exclude amqlib and amqp-connection-manager because they should be installed by the package using rc
1 parent 7c6f574 commit 4c9afcd

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

package-lock.json

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"node": ">=6.0.0"
2020
},
2121
"scripts": {
22-
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
22+
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
2323
"prebuild": "rimraf dist",
2424
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
2525
"start": "rollup -c rollup.config.ts -w",
@@ -51,13 +51,12 @@
5151
},
5252
"jest": {
5353
"transform": {
54-
".(ts|tsx)": "ts-jest"
54+
".ts": "ts-jest"
5555
},
5656
"testEnvironment": "node",
57-
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
57+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|js)$",
5858
"moduleFileExtensions": [
5959
"ts",
60-
"tsx",
6160
"js"
6261
],
6362
"coveragePathIgnorePatterns": [
@@ -88,6 +87,8 @@
8887
"devDependencies": {
8988
"@commitlint/cli": "^8.1.0",
9089
"@commitlint/config-conventional": "^8.1.0",
90+
"@types/amqp-connection-manager": "^2.0.4",
91+
"@types/amqplib": "^0.5.13",
9192
"@types/jest": "^24.0.15",
9293
"@types/node": "^12.6.8",
9394
"colors": "^1.3.3",
@@ -122,7 +123,7 @@
122123
},
123124
"dependencies": {
124125
"amqp-connection-manager": "^3.0.0",
125-
"amqplib": "^0.5.3",
126+
"amqplib": "^0.5.5",
126127
"lodash": "^4.17.15",
127128
"uuid": "^3.3.2"
128129
}

rollup.config.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ const libraryName = 'reactive-commons'
1212
export default {
1313
input: `src/${libraryName}.ts`,
1414
output: [
15-
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true },
16-
{ file: pkg.module, format: 'es', sourcemap: true },
15+
{ file: pkg.main, name: camelCase(libraryName), format: 'cjs', sourcemap: true },
16+
{ file: pkg.module, format: 'esm', sourcemap: true }
1717
],
1818
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
19-
external: [],
19+
external: [
20+
'amqplib',
21+
'amqp-connection-manager'
22+
],
2023
watch: {
21-
include: 'src/**',
24+
include: 'src/**'
2225
},
2326
plugins: [
2427
// Allow json resolution
@@ -30,9 +33,9 @@ export default {
3033
// Allow node_modules resolution, so you can use 'external' to control
3134
// which external modules to include in the bundle
3235
// https://github.com/rollup/rollup-plugin-node-resolve#usage
33-
resolve(),
36+
resolve({ preferBuiltins: true }),
3437

3538
// Resolve source maps to the original source
36-
sourceMaps(),
37-
],
39+
sourceMaps()
40+
]
3841
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"moduleResolution": "node",
44
"target": "es5",
55
"module":"es2015",
6-
"lib": ["es2015", "es2016", "es2017", "dom"],
6+
"lib": ["es2015", "es2016", "es2017"],
77
"strict": true,
88
"sourceMap": true,
99
"declaration": true,

0 commit comments

Comments
 (0)