Skip to content

Commit c9f1454

Browse files
authored
Merge pull request #167 from devrnt/158-syntaxerror-cannot-use-import-statement-outside-a-module
158 syntaxerror cannot use import statement outside a module
2 parents 821fb19 + 6cc876d commit c9f1454

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: '14.x'
15+
node-version: '18.x'
1616

1717
- name: Get yarn cache
1818
id: yarn-cache
@@ -26,7 +26,7 @@ jobs:
2626
restore-keys: |
2727
${{ runner.os }}-yarn-
2828
29-
- run: yarn install --frozen-lockfile
29+
- run: yarn install --frozen-lockfile --ignore-engines
3030
- run: yarn build
3131
- run: yarn build:playground
3232

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
node: ['14.x', '16.x']
10+
node: ['16.x', '18.x']
1111
os: [ubuntu-20.04]
1212

1313
steps:
@@ -21,6 +21,8 @@ jobs:
2121

2222
- name: Install deps and build (with cache)
2323
uses: bahmutov/npm-install@v1
24+
with:
25+
install-command: yarn install --ignore-engines
2426

2527
- name: Lint
2628
run: yarn lint

.github/workflows/size.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@ jobs:
66
env:
77
CI_JOB_NUMBER: 1
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: andresz1/size-limit-action@v1
9+
- name: Checkout repo
10+
uses: actions/checkout@v2
11+
12+
- name: Setup Node
13+
uses: actions/setup-node@v1
1114
with:
12-
github_token: ${{ secrets.GITHUB_TOKEN }}
15+
node-version: '18.x'
16+
17+
- name: Install deps and build (with cache)
18+
uses: bahmutov/npm-install@v1
19+
with:
20+
install-command: yarn install --ignore-engines
21+
22+
- uses: preactjs/compressed-size-action@v2
23+
with:
24+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
25+
pattern: "**/dist/**/*.?(m)js"

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"author": "devrnt <[email protected]>",
44
"description": "React wizard (stepper) builder without the hassle, powered by hooks.",
55
"homepage": "https://github.com/devrnt/react-use-wizard#readme",
6-
"module": "dist/react-use-wizard.esm.js",
6+
"module": "dist/react-use-wizard.mjs",
77
"version": "2.2.1",
88
"license": "MIT",
99
"main": "dist/index.js",
10-
"typings": "dist/index.d.ts",
10+
"types": "dist/index.d.ts",
1111
"sideEffects": false,
1212
"repository": {
1313
"type": "git",
@@ -25,8 +25,8 @@
2525
},
2626
"exports": {
2727
".": {
28-
"browser": "./dist/react-use-wizard.esm.js",
29-
"import": "./dist/react-use-wizard.esm.js",
28+
"browser": "./dist/react-use-wizard.mjs",
29+
"import": "./dist/react-use-wizard.mjs",
3030
"require": "./dist/index.js"
3131
}
3232
},

tsdx.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const path = require('node:path');
2+
3+
// Not transpiled with TypeScript or Babel, so use plain Es6/Node.js!
4+
module.exports = {
5+
// This function will run for each entry/format/env combination
6+
rollup(config, options) {
7+
if (options.format === 'esm') {
8+
const outputFile = path.join(__dirname, 'dist', `${options.name}.mjs`);
9+
10+
return {
11+
...config,
12+
output: {
13+
...config.output,
14+
file: outputFile,
15+
},
16+
};
17+
}
18+
19+
return config;
20+
},
21+
};

0 commit comments

Comments
 (0)