Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit bbc1ccb

Browse files
committed
add webpack, bump all the versions
1 parent 4f6078c commit bbc1ccb

File tree

5 files changed

+1532
-189
lines changed

5 files changed

+1532
-189
lines changed

.storybook/webpack.config.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ module.exports = {
2222
},
2323
{
2424
test: /\.tsx?$/,
25-
loader: 'ts-loader',
25+
loader: 'awesome-typescript-loader?declaration=false',
2626
},
2727
{
2828
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
2929
loader: "file-loader"
30-
},
31-
{
32-
test: /\.story\.tsx?$/,
33-
loaders: [{
34-
loader: require.resolve('@storybook/addon-storysource/loader'),
35-
options: { parser: 'typescript' }
36-
}],
37-
enforce: 'pre',
38-
},
30+
}
3931
]
4032
},
4133
resolve: {

package.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,37 @@
88
"storybook:github": "storybook-to-ghpages"
99
},
1010
"dependencies": {
11-
"lodash": "^4.17.5",
12-
"mathjs": "^4.1.1",
13-
"react": "^16.3.1"
11+
"lodash": "^4.17.10",
12+
"mathjs": "^4.1.2",
13+
"react": "^16.3.2"
1414
},
1515
"devDependencies": {
16-
"@storybook/addon-actions": "^3.4.1",
17-
"@storybook/addon-knobs": "^3.4.1",
18-
"@storybook/addon-options": "^3.4.1",
19-
"@storybook/addon-storysource": "^3.4.1",
20-
"@storybook/addons": "^3.4.1",
21-
"@storybook/react": "^3.4.1",
22-
"@types/lodash": "^4.14.107",
16+
"@storybook/addon-actions": "^3.4.2",
17+
"@storybook/addon-knobs": "^3.4.2",
18+
"@storybook/addon-options": "^3.4.2",
19+
"@storybook/addon-storysource": "^3.4.2",
20+
"@storybook/addons": "^3.4.2",
21+
"@storybook/react": "^3.4.2",
22+
"@types/lodash": "^4.14.108",
2323
"@types/mathjs": "^3.20.0",
24-
"@types/react": "^16.3.10",
24+
"@types/react": "^16.3.13",
2525
"@types/react-dom": "^16.0.5",
26-
"awesome-typescript-loader": "^5.0.0",
27-
"babel-core": "^6.26.0",
26+
"awesome-typescript-loader": "4",
27+
"babel-core": "^6.26.3",
2828
"css-loader": "^0.28.11",
2929
"file-loader": "^1.1.11",
30-
"node-sass": "^4.8.3",
31-
"prettier": "^1.12.0",
32-
"react-dom": "^16.3.1",
30+
"node-sass": "^4.9.0",
31+
"prettier": "^1.12.1",
32+
"react-dom": "^16.3.2",
3333
"sass-loader": "^7.0.1",
3434
"source-map-loader": "^0.2.3",
3535
"storybook-host": "^4.1.5",
36-
"style-loader": "^0.20.3",
37-
"ts-loader": "3",
38-
"tsconfig-paths-webpack-plugin": "^3.0.3",
39-
"typescript": "^2.8.1"
36+
"style-loader": "^0.21.0",
37+
"ts-loader": "^4.2.0",
38+
"tsconfig-paths-webpack-plugin": "^3.0.4",
39+
"typescript": "^2.8.3",
40+
"webpack": "^4.6.0",
41+
"webpack-cli": "^2.0.15",
42+
"webpack-node-externals": "^1.7.2"
4043
}
4144
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"compilerOptions": {
55
"suppressExcessPropertyErrors": true,
66
"declaration": true,
7-
"outDir": "dist/@types",
7+
"outDir": "@types",
88
"target": "es5",
99
"strictNullChecks": false,
1010
"sourceMap": true,

webpack.config.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const webpack = require("webpack");
2+
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
3+
const nodeExternals = require('webpack-node-externals');
4+
5+
const production = process.env.NODE_ENV === "production";
6+
let plugins = [];
7+
8+
if (production) {
9+
console.log("creating production build");
10+
plugins.push(
11+
new webpack.DefinePlugin({
12+
"process.env.NODE_ENV": '"production"'
13+
})
14+
);
15+
}
16+
17+
module.exports = {
18+
entry: "./src/main.ts",
19+
output: {
20+
filename: "main.js",
21+
path: __dirname + "/dist",
22+
libraryTarget: "umd",
23+
library: "storm-react-canvas"
24+
},
25+
externals: [nodeExternals()],
26+
plugins: plugins,
27+
module: {
28+
rules: [
29+
{
30+
enforce: "pre",
31+
test: /\.js$/,
32+
loader: "source-map-loader"
33+
},
34+
{
35+
test: /\.tsx?$/,
36+
loader: "ts-loader"
37+
}
38+
]
39+
},
40+
resolve: {
41+
extensions: [".tsx", ".ts", ".js"]
42+
},
43+
devtool: production ? "source-map" : "cheap-module-source-map",
44+
mode: production ? "production" : "development",
45+
optimization: {
46+
minimizer: [
47+
new UglifyJsPlugin({
48+
uglifyOptions: {
49+
compress: false,
50+
ecma: 5,
51+
mangle: false
52+
},
53+
sourceMap: true
54+
})
55+
]
56+
}
57+
};

0 commit comments

Comments
 (0)