Skip to content

Commit c6d5648

Browse files
author
Peter Hegman
committed
Adjust build config options
1 parent 91af8b3 commit c6d5648

8 files changed

+17
-18
lines changed
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module.exports = {
22
entry: {
3-
index: './src/index.ts'
3+
index: './src/animate-vanilla-js.ts'
44
},
55
output: {
66
filename: 'animate-vanilla-js-browser.js',
7-
libraryTarget: 'window',
8-
library: 'vanillaJsAnimate'
7+
libraryTarget: 'var',
8+
libraryExport: 'default',
9+
library: 'animateVanillaJs'
910
}
1011
}

build-config/webpack.demo.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
44

55
module.exports = {
66
entry: {
7-
index: './src/demo.ts'
7+
index: './src/animate-vanilla-js-demo.ts'
88
},
99
output: {
1010
filename: 'animate-vanilla-js-demo.js'

build-config/webpack.umd.config.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module.exports = {
22
entry: {
3-
index: './src/index.ts'
3+
index: './src/animate-vanilla-js.ts'
44
},
55
output: {
66
filename: 'animate-vanilla-js-umd.js',
77
libraryTarget: 'umd',
8-
library: 'animate-vanilla-js',
9-
umdNamedDefine: true
8+
library: 'animate-vanilla-js'
109
}
1110
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"webpack-merge": "^4.2.1"
3030
},
3131
"scripts": {
32-
"build": "rimraf dist && webpack --mode production",
32+
"build": "rimraf dist && webpack --mode production && mv dist/animate-vanilla-js.d.ts dist/animate-vanilla-js-umd.d.ts",
3333
"serve": "webpack-dev-server --hot --inline --mode development"
3434
},
3535
"husky": {

src/CancelablePromise.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Cancel from './interfaces/promise/cancel.interface'
33
import Resolve from './interfaces/promise/resolve.interface'
44
import CancelHandler from './interfaces/promise/cancel-handler.interface'
55

6-
export default class CancelablePromise<T> extends Promise<T> {
6+
export default class CancelablePromise<T> {
77
private cancelHandler: CancelHandler = reason => {}
88
private isPending: boolean
99
private promise: Promise<T>
@@ -18,7 +18,6 @@ export default class CancelablePromise<T> extends Promise<T> {
1818
arg2: (handler: any) => void
1919
): void
2020
}) {
21-
super(function(resolve, reject) {})
2221
this.isPending = true
2322
this.isCanceled = false
2423

src/demo.ts renamed to src/animate-vanilla-js-demo.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference types="webpack-env" />
22

33
require('./sass/app.scss')
4-
import animate from './index'
4+
import animate from './animate-vanilla-js'
55

66
function addEventListenerMulti(
77
element: Element | NodeList,
@@ -149,8 +149,8 @@ function animateScrollDemo() {
149149
}
150150

151151
if (module.hot) {
152-
module.hot.accept('./index', () => {
153-
const animate = require('./index')
152+
module.hot.accept('./animate-vanilla-js', () => {
153+
const animate = require('./animate-vanilla-js')
154154
init()
155155
})
156156
}
File renamed without changes.

tsconfig.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"outDir": "./dist/",
44
"sourceMap": true,
55
"noImplicitAny": true,
6-
"module": "es6",
7-
"allowJs": true,
8-
"target": "es6"
9-
},
10-
"transpileOnly": true
6+
"target": "es5",
7+
"downlevelIteration": true,
8+
"lib": ["es5", "es6", "dom", "dom.iterable"],
9+
"declaration": true
10+
}
1111
}

0 commit comments

Comments
 (0)