Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
fix(treats): fix webpack production build error (#37)
Browse files Browse the repository at this point in the history
* fix(packages/treats): fix webpack server build
  • Loading branch information
Salman Al Fariz authored Sep 4, 2019
1 parent 02f1d92 commit 29ebb2b
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 50 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="0.4.3"></a>
# 0.4.3 (2019-09-03)


### Bug Fixes

* Fix webpack production build with react-router-dom version 5.0.0. ([#37](https://github.com/tokopedia/treats/pull/37)) ([26afba7](https://github.com/tokopedia/treats/commit/26afba7)) This fix the temporary solution from ([#36](https://github.com/tokopedia/treats/pull/36)).



<a name="0.4.2"></a>
# 0.4.2 (2019-09-02)


### Bug Fixes

* fix react-router-dom error on production build. ([#36](https://github.com/tokopedia/treats/pull/35))
* fix react-router-dom error on production build. ([#36](https://github.com/tokopedia/treats/pull/36))



Expand All @@ -19,6 +30,8 @@ All notable changes to this project will be documented in this file. See [standa

* fix vulnerable dependencies ([#35](https://github.com/tokopedia/treats/issues/35)) ([3115568](https://github.com/tokopedia/treats/commit/3115568))



<a name="0.4.0"></a>
# 0.4.0 (2019-06-24)

Expand Down
4 changes: 2 additions & 2 deletions example/app-with-workbox/generate-sw/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-with-workbox",
"version": "0.0.3",
"version": "0.0.4",
"description": "My First Treats App",
"license": "ISC",
"scripts": {
Expand All @@ -22,6 +22,6 @@
"test:coverage": "treats test --coverage"
},
"dependencies": {
"treats": "0.4.2"
"treats": "0.4.3"
}
}
4 changes: 2 additions & 2 deletions example/app-with-workbox/inject-manifest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-with-workbox",
"version": "0.0.3",
"version": "0.0.4",
"description": "My First Treats App",
"license": "ISC",
"scripts": {
Expand All @@ -22,6 +22,6 @@
"test:coverage": "treats test --coverage"
},
"dependencies": {
"treats": "0.4.2"
"treats": "0.4.3"
}
}
4 changes: 2 additions & 2 deletions example/authoring-addons/my-first-addons/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@treats/my-first-addons",
"license": "Apache-2.0",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Tokopedia Engineering",
"peerDependencies": {
"treats": "0.4.2"
"treats": "0.4.3"
}
}
4 changes: 2 additions & 2 deletions example/authoring-addons/my-treats-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "my-treats-app",
"version": "0.4.2",
"version": "0.4.3",
"description": "My First Treats App",
"license": "ISC",
"scripts": {
Expand All @@ -20,6 +20,6 @@
},
"dependencies": {
"@treats/my-first-addons": "^1.0.0",
"treats": "0.4.2"
"treats": "0.4.3"
}
}
4 changes: 2 additions & 2 deletions example/emotion-critical-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emotion-example",
"version": "0.4.2",
"version": "0.4.3",
"description": "Emotion Critical CSS Example",
"license": "ISC",
"scripts": {
Expand All @@ -22,7 +22,7 @@
"emotion": "9.2.12",
"emotion-server": "9.2.12",
"react-emotion": "9.2.12",
"treats": "0.4.2"
"treats": "0.4.3"
},
"devDependencies": {
"babel-plugin-emotion": "9.2.11"
Expand Down
4 changes: 2 additions & 2 deletions example/emotion-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emotion-css",
"version": "0.4.2",
"version": "0.4.3",
"description": "Emotion CSS Example",
"license": "ISC",
"scripts": {
Expand All @@ -22,7 +22,7 @@
"emotion": "9.2.12",
"emotion-server": "9.2.12",
"react-emotion": "9.2.12",
"treats": "0.4.2"
"treats": "0.4.3"
},
"devDependencies": {
"babel-plugin-emotion": "9.2.11"
Expand Down
4 changes: 2 additions & 2 deletions example/less-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "less-css",
"version": "0.4.2",
"version": "0.4.3",
"description": "Less CSS example",
"license": "ISC",
"scripts": {
Expand All @@ -19,7 +19,7 @@
"documentation:flush": "treats documentation flush src/"
},
"dependencies": {
"treats": "0.4.2",
"treats": "0.4.3",
"less": "2.3.1"
}
}
4 changes: 2 additions & 2 deletions example/sass-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sass-css",
"version": "0.4.2",
"version": "0.4.3",
"description": "Sass CSS example",
"license": "ISC",
"scripts": {
Expand All @@ -19,7 +19,7 @@
"documentation:flush": "treats documentation flush src/"
},
"dependencies": {
"treats": "0.4.2",
"treats": "0.4.3",
"node-sass": "4.10.0"
}
}
4 changes: 2 additions & 2 deletions example/styled-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "styled-components",
"version": "0.4.2",
"version": "0.4.3",
"description": "Styled Components Example",
"license": "ISC",
"scripts": {
Expand All @@ -20,7 +20,7 @@
},
"dependencies": {
"styled-components": "4.1.1",
"treats": "0.4.2"
"treats": "0.4.3"
},
"devDependencies": {
"babel-plugin-styled-components": "1.8.0"
Expand Down
6 changes: 3 additions & 3 deletions example/tutorial-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"test:coverage": "treats test --coverage"
},
"dependencies": {
"@treats/addons-base": "0.4.2",
"axios": "^0.18.0",
"treats": "0.4.2"
"@treats/addons-base": "0.4.3",
"axios": "^0.18.1",
"treats": "0.4.3"
}
}
4 changes: 2 additions & 2 deletions example/typescript-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-app",
"version": "0.4.2",
"version": "0.4.3",
"description": "My First Treats App with Typescript Language!",
"license": "ISC",
"scripts": {
Expand All @@ -22,7 +22,7 @@
"test:coverage": "treats test --coverage"
},
"dependencies": {
"treats": "0.4.2",
"treats": "0.4.3",
"typescript": "3.2.2",
"@types/enzyme": "3.1.15",
"@types/jest": "23.3.10",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.11.0",
"version": "0.4.2",
"version": "0.4.3",
"packages": [
"packages/*"
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "treats-repo",
"version": "0.4.2",
"version": "0.4.3",
"description": "Tokopedia React Development Kits Repository",
"author": "Tokopedia Engineering",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/addons-base/generator/opinionated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"devDependencies": {
"eslint": "5.8.0",
"eslint-config-treats": "0.1.1",
"eslint-config-treats": "0.4.0",
"flow-bin": "0.67.1",
"flow-coverage-report": "0.5.0",
"flow-typed": "2.5.1",
"husky": "0.14.3",
"lint-staged": "7.1.3",
"prettier": "1.13.4",
"stylelint": "9.7.1",
"stylelint-config-treats": "0.1.1"
"stylelint-config-treats": "0.4.0"
}
}
4 changes: 2 additions & 2 deletions packages/addons-base/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@treats/addons-base",
"license": "Apache-2.0",
"version": "0.4.2",
"version": "0.4.3",
"description": "Treats Addons Base",
"main": "index.js",
"author": "Tokopedia Engineering",
"peerDependencies": {
"treats": "0.4.2"
"treats": "0.4.3"
},
"dependencies": {
"bluebird": "3.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:coverage": "treats test --coverage"
},
"dependencies": {
"treats": "0.4.1<%if(USE_TYPESCRIPT)%>",
"treats": "0.4.3<%if(USE_TYPESCRIPT)%>",
"typescript": "3.2.2",
"@types/enzyme": "3.1.15",
"@types/jest": "23.3.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-treats-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-treats-app",
"license": "Apache-2.0",
"version": "0.4.2",
"version": "0.4.3",
"description": "Create Treats App",
"main": "./index.js",
"bin": {
Expand Down
5 changes: 3 additions & 2 deletions packages/treats/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "treats",
"license": "Apache-2.0",
"version": "0.4.2",
"version": "0.4.3",
"description": "Tokopedia React Development Kits",
"author": "Tokopedia Engineering",
"types": "./lib/treats.d.ts",
Expand Down Expand Up @@ -110,7 +110,7 @@
"react-hot-loader": "4.6.0",
"react-intl": "2.7.2",
"react-redux": "5.1.0",
"react-router-dom": "4.3.1",
"react-router-dom": "5.0.0",
"react-universal-component": "3.0.3",
"redux": "4.0.1",
"redux-devtools-extension": "2.13.5",
Expand All @@ -127,6 +127,7 @@
"webpack-dev-server": "3.1.11",
"webpack-flush-chunks": "1.2.3",
"webpack-merge": "4.1.4",
"webpack-node-externals": "1.7.2",
"webpack-source-map-support": "2.0.1",
"winston": "2.4.2",
"workbox-webpack-plugin": "4.1.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/treats/scripts/config/webpack.config.server.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const webpack = require("webpack"),
babelMerge = require("babel-merge"),
webpackMerge = require("webpack-merge"),
extractEnv = require("./util/extract-env"),
useTypescript = fs.pathExistsSync(path.resolve(process.cwd(), "./tsconfig.json"));
useTypescript = fs.pathExistsSync(path.resolve(process.cwd(), "./tsconfig.json")),
nodeExternals = require("webpack-node-externals");

module.exports = ({
alias,
Expand Down Expand Up @@ -40,13 +41,12 @@ module.exports = ({
...resolve,
alias
},
externals: fs
.readdirSync("./node_modules")
.filter(x => !/\.bin|react-universal-component|webpack-flush-chunks|treats/.test(x))
.reduce((externals, mod) => {
externals[mod] = `commonjs ${mod}`;
return externals;
}, {}),
externals: nodeExternals({
whitelist: [
/\.bin|react-universal-component|webpack-flush-chunks|treats/,
/babel-plugin-universal-import|react-universal-component/
]
}),
node: {
__dirname: false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const webpack = require("webpack"),
babelMerge = require("babel-merge"),
webpackMerge = require("webpack-merge"),
extractEnv = require("./util/extract-env"),
useTypescript = fs.pathExistsSync(path.resolve(process.cwd(), "./tsconfig.json"));
useTypescript = fs.pathExistsSync(path.resolve(process.cwd(), "./tsconfig.json")),
nodeExternals = require("webpack-node-externals");

module.exports = ({
alias,
Expand All @@ -33,13 +34,13 @@ module.exports = ({
mode: "development",
devtool: "cheap-eval-source-map",
entry: ["webpack/hot/signal?1000", path.join(alias["@treats/server"], "./entry")],
externals: fs
.readdirSync("./node_modules")
.filter(x => !/\.bin|react-universal-component|webpack-flush-chunks|treats/.test(x))
.reduce((externals, mod) => {
externals[mod] = `commonjs ${mod}`;
return externals;
}, {}),
externals: nodeExternals({
whitelist: [
/\.bin|react-universal-component|webpack-flush-chunks|treats/,
/babel-plugin-universal-import|react-universal-component/,
"webpack/hot/signal?1000"
]
}),
watch: true,
resolve: {
...resolve,
Expand Down

0 comments on commit 29ebb2b

Please sign in to comment.