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

Commit

Permalink
add webpack, bump all the versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanvorster committed Apr 27, 2018
1 parent 4f6078c commit bbc1ccb
Show file tree
Hide file tree
Showing 5 changed files with 1,532 additions and 189 deletions.
12 changes: 2 additions & 10 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,12 @@ module.exports = {
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
loader: 'awesome-typescript-loader?declaration=false',
},
{
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
loader: "file-loader"
},
{
test: /\.story\.tsx?$/,
loaders: [{
loader: require.resolve('@storybook/addon-storysource/loader'),
options: { parser: 'typescript' }
}],
enforce: 'pre',
},
}
]
},
resolve: {
Expand Down
43 changes: 23 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,37 @@
"storybook:github": "storybook-to-ghpages"
},
"dependencies": {
"lodash": "^4.17.5",
"mathjs": "^4.1.1",
"react": "^16.3.1"
"lodash": "^4.17.10",
"mathjs": "^4.1.2",
"react": "^16.3.2"
},
"devDependencies": {
"@storybook/addon-actions": "^3.4.1",
"@storybook/addon-knobs": "^3.4.1",
"@storybook/addon-options": "^3.4.1",
"@storybook/addon-storysource": "^3.4.1",
"@storybook/addons": "^3.4.1",
"@storybook/react": "^3.4.1",
"@types/lodash": "^4.14.107",
"@storybook/addon-actions": "^3.4.2",
"@storybook/addon-knobs": "^3.4.2",
"@storybook/addon-options": "^3.4.2",
"@storybook/addon-storysource": "^3.4.2",
"@storybook/addons": "^3.4.2",
"@storybook/react": "^3.4.2",
"@types/lodash": "^4.14.108",
"@types/mathjs": "^3.20.0",
"@types/react": "^16.3.10",
"@types/react": "^16.3.13",
"@types/react-dom": "^16.0.5",
"awesome-typescript-loader": "^5.0.0",
"babel-core": "^6.26.0",
"awesome-typescript-loader": "4",
"babel-core": "^6.26.3",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"node-sass": "^4.8.3",
"prettier": "^1.12.0",
"react-dom": "^16.3.1",
"node-sass": "^4.9.0",
"prettier": "^1.12.1",
"react-dom": "^16.3.2",
"sass-loader": "^7.0.1",
"source-map-loader": "^0.2.3",
"storybook-host": "^4.1.5",
"style-loader": "^0.20.3",
"ts-loader": "3",
"tsconfig-paths-webpack-plugin": "^3.0.3",
"typescript": "^2.8.1"
"style-loader": "^0.21.0",
"ts-loader": "^4.2.0",
"tsconfig-paths-webpack-plugin": "^3.0.4",
"typescript": "^2.8.3",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15",
"webpack-node-externals": "^1.7.2"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"compilerOptions": {
"suppressExcessPropertyErrors": true,
"declaration": true,
"outDir": "dist/@types",
"outDir": "@types",
"target": "es5",
"strictNullChecks": false,
"sourceMap": true,
Expand Down
57 changes: 57 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const nodeExternals = require('webpack-node-externals');

const production = process.env.NODE_ENV === "production";
let plugins = [];

if (production) {
console.log("creating production build");
plugins.push(
new webpack.DefinePlugin({
"process.env.NODE_ENV": '"production"'
})
);
}

module.exports = {
entry: "./src/main.ts",
output: {
filename: "main.js",
path: __dirname + "/dist",
libraryTarget: "umd",
library: "storm-react-canvas"
},
externals: [nodeExternals()],
plugins: plugins,
module: {
rules: [
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader"
},
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
devtool: production ? "source-map" : "cheap-module-source-map",
mode: production ? "production" : "development",
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
compress: false,
ecma: 5,
mangle: false
},
sourceMap: true
})
]
}
};
Loading

0 comments on commit bbc1ccb

Please sign in to comment.