Skip to content

Commit

Permalink
feat: add option to include directories and fix sourcemaps (#4591)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrancois authored Feb 23, 2023
1 parent 440cf32 commit 0bc6a9e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/mean-carrots-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@talend/scripts-config-react-webpack': minor
---

feat: add options to fix sourcemaps in mono repository.
chore: upgrade fork-ts-checker-webpack-plugin@^7.3.0
1 change: 1 addition & 0 deletions packages/playground/talend-scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cmf": true,
"html": {},
"webpack": {
"monoRepoFixSourceMap": ["../dataviz/src", "../containers/src", "../components/src"],
"config": {
"development": "./webpack.config.dev.js",
"production": "./webpack.config.dev.js"
Expand Down
7 changes: 6 additions & 1 deletion tools/scripts-config-react-webpack/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ module.exports = ({ getUserConfig, mode }) => {
const isEnvDevelopmentServe = isEnvDevelopment && process.env.WEBPACK_SERVE === 'true';
const b64favicon = icons.getFavicon(theme);

const srcDirectories = (getUserConfig('webpack', {})?.monoRepoFixSourceMap || [])
.map(src => path.resolve(process.cwd(), src))
.concat([path.resolve(process.cwd(), './src/app')]);

return {
mode,
entry: `${process.cwd()}/src/app/index`,
Expand All @@ -286,13 +290,14 @@ module.exports = ({ getUserConfig, mode }) => {
rules: [
isEnvDevelopment && {
test: /\.js$/,
include: /@talend/,
include: /node_modules/,
use: ['source-map-loader'],
enforce: 'pre',
},
{
test: useTypescript ? /\.(js|ts|tsx)$/ : /\.js$/,
exclude: /node_modules/,
include: srcDirectories,
use: getJSAndTSLoader(env, useTypescript),
},
{
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts-config-react-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"core-js-bundle": "^3.27.2",
"css-loader": "^4.3.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.5.2",
"fork-ts-checker-webpack-plugin": "^7.3.0",
"html-webpack-plugin": "^5.5.0",
"inspectpack": "^4.7.1",
"mini-css-extract-plugin": "^2.7.2",
Expand Down
31 changes: 27 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
dependencies:
"@babel/highlight" "^7.10.4"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3":
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a"
integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==
Expand Down Expand Up @@ -10179,7 +10179,7 @@ fork-ts-checker-webpack-plugin@^4.1.6:
tapable "^1.0.0"
worker-rpc "^0.1.0"

fork-ts-checker-webpack-plugin@^6.0.4, fork-ts-checker-webpack-plugin@^6.5.2:
fork-ts-checker-webpack-plugin@^6.0.4:
version "6.5.2"
resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-6.5.2.tgz#4f67183f2f9eb8ba7df7177ce3cf3e75cdafb340"
integrity sha512-m5cUmF30xkZ7h4tWUgTAcEaKmUW7tfyUyTqNNOz7OxWJ0v1VWKTcOvH8FWHUwSjlW/356Ijc9vi3XfcPstpQKA==
Expand All @@ -10198,6 +10198,24 @@ fork-ts-checker-webpack-plugin@^6.0.4, fork-ts-checker-webpack-plugin@^6.5.2:
semver "^7.3.2"
tapable "^1.0.0"

fork-ts-checker-webpack-plugin@^7.3.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-7.3.0.tgz#a9c984a018493962360d7c7e77a67b44a2d5f3aa"
integrity sha512-IN+XTzusCjR5VgntYFgxbxVx3WraPRnKehBFrf00cMSrtUuW9MsG9dhL6MWpY6MkjC3wVwoujfCDgZZCQwbswA==
dependencies:
"@babel/code-frame" "^7.16.7"
chalk "^4.1.2"
chokidar "^3.5.3"
cosmiconfig "^7.0.1"
deepmerge "^4.2.2"
fs-extra "^10.0.0"
memfs "^3.4.1"
minimatch "^3.0.4"
node-abort-controller "^3.0.1"
schema-utils "^3.1.1"
semver "^7.3.5"
tapable "^2.2.1"

form-data@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
Expand Down Expand Up @@ -13821,7 +13839,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==

memfs@^3.1.2, memfs@^3.4.3:
memfs@^3.1.2, memfs@^3.4.1, memfs@^3.4.3:
version "3.4.13"
resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.4.13.tgz#248a8bd239b3c240175cd5ec548de5227fc4f345"
integrity sha512-omTM41g3Skpvx5dSYeZIbXKcXoAVc/AoMNwn9TKx++L/gaen/+4TTttmu8ZSch5vfVJ8uJvGbroTsIlslRg6lg==
Expand Down Expand Up @@ -14379,6 +14397,11 @@ no-case@^3.0.4:
lower-case "^2.0.2"
tslib "^2.0.3"

node-abort-controller@^3.0.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548"
integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==

node-dir@^0.1.10:
version "0.1.17"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
Expand Down Expand Up @@ -19042,7 +19065,7 @@ tapable@^1.0.0, tapable@^1.1.3:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==

tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0:
tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
Expand Down

0 comments on commit 0bc6a9e

Please sign in to comment.