diff --git a/client/.eslintrc.js b/client/.eslintrc.js index e8e151c..c17b153 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -41,7 +41,8 @@ module.exports = { 'eol-last': [ 'error', 'always' - ] + ], + '@typescript-eslint/no-var-requires': 0, }, 'settings': { 'react': { diff --git a/client/package-lock.json b/client/package-lock.json index 08a9e67..87abcb4 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -72,6 +72,7 @@ "webpack-dev-middleware": "^5.3.1", "webpack-dev-server": "^4.8.1", "webpack-hot-middleware": "^2.25.1", + "webpack-node-externals": "^3.0.0", "workbox-webpack-plugin": "^6.5.3", "workbox-window": "^6.5.3" } @@ -11088,6 +11089,15 @@ "node": ">=10.0.0" } }, + "node_modules/webpack-node-externals": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz", + "integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", @@ -19593,6 +19603,12 @@ "wildcard": "^2.0.0" } }, + "webpack-node-externals": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz", + "integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==", + "dev": true + }, "webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", diff --git a/client/package.json b/client/package.json index ec08b51..7c45685 100644 --- a/client/package.json +++ b/client/package.json @@ -4,7 +4,7 @@ "description": "Starter Kit de server side render de react", "main": "src/server/index", "scripts": { - "start": "ts-node src/server", + "start": "node build/server/app-server.js", "start:dev": "nodemon --exec 'ts-node' src/server/index -e js,json,ts,tsx,jsx", "build": "webpack-cli --config webpack.config.js", "lint": "eslint ./ --ext .js --ext .ts --ext .jsx --ext .tsx", @@ -89,6 +89,7 @@ "webpack-dev-middleware": "^5.3.1", "webpack-dev-server": "^4.8.1", "webpack-hot-middleware": "^2.25.1", + "webpack-node-externals": "^3.0.0", "workbox-webpack-plugin": "^6.5.3", "workbox-window": "^6.5.3" } diff --git a/client/src/server/index.js b/client/src/server/index.js index 1b6d81b..c977062 100644 --- a/client/src/server/index.js +++ b/client/src/server/index.js @@ -8,7 +8,7 @@ require('@babel/register')({ 'presets': [ '@babel/preset-env', '@babel/preset-react', - "@babel/preset-typescript", + '@babel/preset-typescript', // '@babel/preset-flow', ] }); diff --git a/client/src/server/server.js b/client/src/server/server.js index 84b0e62..5f57132 100644 --- a/client/src/server/server.js +++ b/client/src/server/server.js @@ -66,9 +66,10 @@ if(env === 'development'){ } const setResponse = (html, preloadedState, manifest) => { - const mainStyles = manifest ? manifest['main.css'] : 'assets/app.css'; - const mainBuild = manifest ? manifest['main.js'] : 'assets/app.js'; + const mainStyles = manifest ? manifest['frontend.css'] : 'assets/app.css'; + const mainBuild = manifest ? manifest['frontend.js'] : 'assets/app.js'; const vendorBuild = manifest ? manifest['vendors.js'] : 'assets/vendor.js'; + const manifestJson = manifest ? `` : ''; return(` @@ -79,7 +80,7 @@ const setResponse = (html, preloadedState, manifest) => { - + ${manifestJson}