Skip to content

Commit 4879d7e

Browse files
committed
fix webpack and vue-cli import: add exports field to package.json
1 parent cb8a583 commit 4879d7e

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/dist/
1+
/dist/*
2+
!/dist/package.json
23

34
node_modules/
45
yarn.lock

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.1.3 - 2023-02-07
2+
- Fix Webpack and vue-cli import
3+
14
## 2.1.2 - 2023-02-04
25
- Fix <title> position: prepend instead of append (#48)
36
- Fix `transformSource` .d.ts types (in #50)

dist/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
{
22
"name": "vue-inline-svg",
3-
"version": "2.1.2",
3+
"version": "2.1.3",
44
"description": "Replace SVG images with inline SVG element",
55
"type": "module",
6+
"exports": {
7+
".": {
8+
"module": "./src/index.js",
9+
"import": "./src/index.js",
10+
"types": "./types/index.d.ts",
11+
"default": "./dist/vue-inline-svg.js"
12+
},
13+
"./*": "./*"
14+
},
615
"main": "dist/vue-inline-svg.js",
716
"module": "src/index.js",
817
"browser": "dist/vue-inline-svg.js",

rollup.conf.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,18 @@ export default [
1515
name: 'VueInlineSvg',
1616
},
1717
// {
18-
// format: 'es',
19-
// file: 'dist/vue-inline-svg.esm.js',
18+
// format: 'cjs',
19+
// file: 'dist/vue-inline-svg.cjs',
2020
// },
21-
],
22-
},
23-
{
24-
input: 'src/index.js',
25-
plugins: [
26-
babel(),
27-
terser(),
28-
],
29-
output: [
3021
{
3122
format: 'umd',
3223
file: 'dist/vue-inline-svg.min.js',
3324
name: 'VueInlineSvg',
34-
}
35-
]
36-
}
25+
globals: {vue: 'Vue'},
26+
plugins: [
27+
terser(),
28+
],
29+
},
30+
],
31+
},
3732
]

0 commit comments

Comments
 (0)