Skip to content

Commit ee0d11b

Browse files
committed
learning about modules n stuff
1 parent 0ef9b39 commit ee0d11b

13 files changed

+21
-18
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ src/index.d.ts
66
yalc.lock
77
.yalc
88
.npmrc
9-
lerna-debug.log
9+
lerna-debug.log
10+
.DS_Store

packages/faro-bundlers-shared/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"extends": "@grafana/tsconfig",
44
"include": ["./**/*", "../package.json"],
55
"compilerOptions": {
6+
"module": "commonjs",
7+
"sourceMap": true,
68
"esModuleInterop": true
79
}
810
}

packages/faro-rollup/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@grafana/faro-rollup-plugin",
33
"version": "0.0.14",
44
"description": "Upload a source map to the Faro source map API from a Rollup build pipeline",
5-
"type": "module",
65
"main": "dist/cjs/index.js",
76
"module": "dist/esm/index.mjs",
87
"repository": {
@@ -14,7 +13,7 @@
1413
"author": "Grafana Labs",
1514
"scripts": {
1615
"build": "rollup --config rollup.config.mjs",
17-
"test": "ava src/index.test.js"
16+
"test": "ava src/index.test.mjs"
1817
},
1918
"devDependencies": {
2019
"ava": "^3.8.1"

packages/faro-rollup/rollup.config.mjs

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default {
3535
extensions,
3636
babelHelpers: "bundled",
3737
include: ["src/**/*"],
38-
exclude: [/node_modules/, /test/, "*.test.ts"]
38+
exclude: [/node_modules/, /test/]
3939
}),
4040
json(),
4141
resolve({
@@ -45,7 +45,6 @@ export default {
4545
}),
4646
commonjs({
4747
include: /node_modules/,
48-
exclude: "*.test.ts"
4948
}),
5049
],
5150
};

packages/faro-rollup/src/index.test.js packages/faro-rollup/src/index.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import { rollup } from 'rollup';
3-
import config from './test/rollup.config.cjs';
3+
import { config } from './test/rollup.config.mjs';
44

55
test('rollup', async t => {
66
const bundle = await rollup(config);

packages/faro-rollup/src/test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "webpack-test-app",
33
"version": "1.0.0",
44
"main": "index.js",
5+
"type": "module",
56
"scripts": {
6-
"build": "rollup --config rollup.config.cjs"
7+
"build": "rollup --config rollup.config.js"
78
},
89
"dependencies": {
910
"@grafana/faro-rollup-plugin": "^0.0.12"

packages/faro-rollup/src/test/rollup.config.cjs packages/faro-rollup/src/test/rollup.config.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const faroUploader = require('@grafana/faro-rollup-plugin');
1+
import faroUploader from '@grafana/faro-rollup-plugin';
22

3-
module.exports =
3+
export const config =
44
{
55
input: "./src/test/main.js",
66
output: {
@@ -16,4 +16,4 @@ module.exports =
1616
bundleId: 'test'
1717
})
1818
]
19-
};
19+
};

packages/faro-rollup/tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"extends": "@grafana/tsconfig",
44
"include": ["./**/*", "../package.json"],
55
"compilerOptions": {
6-
"esModuleInterop": true
6+
"module": "commonjs",
7+
"sourceMap": true,
8+
"esModuleInterop": true,
9+
"allowImportingTsExtensions": true
710
}
811
}

packages/faro-webpack/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@grafana/faro-webpack-plugin",
33
"version": "0.0.14",
44
"description": "Upload a source map to the Faro source map API from a Webpack build pipeline ",
5-
"type": "module",
65
"main": "dist/cjs/index.js",
76
"module": "dist/esm/index.mjs",
87
"repository": {
@@ -14,7 +13,7 @@
1413
"author": "Grafana Labs",
1514
"scripts": {
1615
"build": "rollup --config rollup.config.mjs",
17-
"test": "ava src/index.test.js"
16+
"test": "ava src/index.test.mjs"
1817
},
1918
"dependencies": {
2019
"@grafana/faro-bundlers-shared": "^0.0.14",

packages/faro-webpack/src/test/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "webpack-test-app",
33
"version": "1.0.0",
4-
"type": "module",
54
"main": "index.js",
65
"scripts": {
76
"build": "webpack"

packages/faro-webpack/src/test/webpack.config.js packages/faro-webpack/src/test/webpack.config.mjs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import FaroSourcemapUploaderPlugin from '@grafana/faro-webpack-plugin';
22
import path from 'path';
33

4-
const config = {
4+
export const config = {
55
entry: {
66
module: './main.cjs'
77
},
@@ -20,6 +20,4 @@ const config = {
2020
bundleId: 'test'
2121
}),
2222
]
23-
};
24-
25-
export default config;
23+
};

packages/faro-webpack/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"rootDir": "./src",
66
"declaration": true,
77
"compilerOptions": {
8+
"module": "commonjs",
9+
"sourceMap": true,
810
"esModuleInterop": true
911
}
1012
}

0 commit comments

Comments
 (0)