Skip to content

Commit 451b179

Browse files
committed
modified build commands
1 parent 0f47bcd commit 451b179

File tree

5 files changed

+74
-53
lines changed

5 files changed

+74
-53
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
.DS_Store
33
node_modules
44

5-
lib
6-
lib-esm
7-
_bundles
5+
dist

package.json

+39-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
{
2-
"name": "icon-element",
3-
"version": "1.0.0",
4-
"description": "SVG icon system utilising a custom element",
5-
"repository": "[email protected]:s5nw/svg-icon-system.git",
6-
"author": "Stephan Weber <[email protected]>",
7-
"license": "MIT",
8-
"private": true,
9-
"devDependencies": {
10-
"@typescript-eslint/eslint-plugin": "^4.2.0",
11-
"@typescript-eslint/parser": "^4.2.0",
12-
"eslint": "^7.9.0",
13-
"eslint-config-bestit-base": "^1.0.0",
14-
"shx": "^0.3.3",
15-
"ts-loader": "^9.2.2",
16-
"typescript": "^4.3.2",
17-
"webpack": "^5.38.1",
18-
"webpack-cli": "^4.7.0"
19-
},
20-
"scripts": {
21-
"clean": "shx rm -rf _bundles lib lib-esm",
22-
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && webpack --mode=production"
23-
},
24-
"dependencies": {}
2+
"name": "icon-element",
3+
"version": "1.0.0",
4+
"description": "SVG icon system utilising a custom element",
5+
"repository": "[email protected]:s5nw/svg-icon-system.git",
6+
"author": "Stephan Weber <[email protected]>",
7+
"license": "MIT",
8+
"private": true,
9+
"main": "./dist/commonjs/index.js",
10+
"module": "./dist/esm/index.js",
11+
"type": "module",
12+
"types": "./dist/types/index.d.ts",
13+
"exports": {
14+
"import": "./dist/esm/index.js",
15+
"require": "./dist/commonjs/index.js",
16+
"default": "./dist/commonjs/index.js"
17+
},
18+
"files": [
19+
"dist"
20+
],
21+
"devDependencies": {
22+
"@typescript-eslint/eslint-plugin": "^4.2.0",
23+
"@typescript-eslint/parser": "^4.2.0",
24+
"eslint": "^7.9.0",
25+
"eslint-config-bestit-base": "^1.0.0",
26+
"shx": "^0.3.3",
27+
"ts-loader": "^9.2.2",
28+
"typescript": "^4.3.2",
29+
"webpack": "^5.38.1",
30+
"webpack-cli": "^4.7.0"
31+
},
32+
"scripts": {
33+
"clean": "shx rm -rf dist",
34+
"build": "yarn run clean && yarn run build:declaration && yarn run build:esm && yarn run build:commonjs && yarn run build:umd",
35+
"build:declaration": "tsc --declaration true --declarationDir ./dist/types --emitDeclarationOnly true",
36+
"build:esm": "tsc --module es2015 --target es6 --outDir dist/esm",
37+
"build:commonjs": "tsc --module commonjs --target es6 --outDir dist/commonjs",
38+
"build:umd": "webpack --mode=production"
39+
},
40+
"dependencies": {}
2541
}

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ <h2>Storyblok element</h2>
228228
</section>
229229
</div>
230230

231-
<script src="../_bundles/icon-element.js"></script>
231+
<script src="../dist/umd/icon-element.js"></script>
232232
<script type="text/javascript">
233233
// Create a custom icon element with the desired name
234234
IconElement.IconService.createElement(

tsconfig.json

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
2-
"compilerOptions": {
3-
"moduleResolution": "node",
4-
"module": "commonjs",
5-
"target": "es6",
6-
"lib": [ "es6", "dom" ],
7-
"outDir": "lib",
8-
"allowSyntheticDefaultImports": true,
9-
"suppressImplicitAnyIndexErrors": true,
10-
"forceConsistentCasingInFileNames": true,
11-
"sourceMap": true,
12-
"declaration": true,
13-
},
14-
"files": [
15-
"./src/index.ts"
16-
],
17-
"compileOnSave": false,
18-
"buildOnSave": false
19-
}
2+
"compilerOptions": {
3+
"moduleResolution": "node",
4+
"module": "es6",
5+
"target": "es6",
6+
"lib": [
7+
"es6",
8+
"dom"
9+
],
10+
"outDir": "dist",
11+
"forceConsistentCasingInFileNames": true,
12+
"sourceMap": true,
13+
"declaration": false,
14+
},
15+
"files": [
16+
"./src/index.ts"
17+
],
18+
"compileOnSave": false,
19+
"buildOnSave": false
20+
}

webpack.config.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
'use strict';
2-
3-
/* eslint-env node */
4-
const path = require('path');
5-
const TerserPlugin = require('terser-webpack-plugin');
1+
import { resolve as _resolve } from 'path';
2+
import TerserPlugin from 'terser-webpack-plugin';
63

74
const PATHS = {
85
entryPoint: './src/index.ts',
9-
bundles: path.resolve(__dirname, '_bundles'),
6+
bundles: _resolve('./dist/umd'),
107
};
118

129
const config = {
@@ -60,11 +57,20 @@ const config = {
6057
rules: [
6158
{
6259
test: /\.tsx?$/,
63-
use: 'ts-loader',
60+
use: [
61+
{
62+
loader: 'ts-loader',
63+
options: {
64+
compilerOptions: {
65+
declaration: false,
66+
},
67+
}
68+
}
69+
],
6470
exclude: /node_modules/,
6571
},
6672
],
6773
},
6874
};
6975

70-
module.exports = config;
76+
export default config;

0 commit comments

Comments
 (0)