Skip to content

Commit

Permalink
build(webpack): sw-1781 platform compile packages (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera authored Jan 16, 2024
1 parent be3a2f8 commit 396c31c
Show file tree
Hide file tree
Showing 13 changed files with 1,066 additions and 834 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ public/locales/*.json
.proxy
.docs
.openapi
.cache
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ module.exports = {
(NODE_ENV === 'development' && browserslist?.development?.join(', ')) ||
browserslist?.production?.join(', ') ||
'entry',
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['@babel/plugin-transform-runtime']
presets: ['@babel/preset-env', '@babel/preset-react']
};
2 changes: 0 additions & 2 deletions config/build.empty.js

This file was deleted.

64 changes: 0 additions & 64 deletions config/build.plugins.js

This file was deleted.

19 changes: 16 additions & 3 deletions config/webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
const { EslintWebpackPlugin, MiniCssExtractPlugin } = require('weldable/lib/packages');
const {
// babelLoaderResolve,
cssLoaderResolve,
sassLoaderResolve,
tsLoaderResolve,
EslintWebpackPlugin,
MiniCssExtractPlugin
} = require('weldable/lib/packages');

module.exports = ({ _BUILD_SRC: SRC_DIR } = {}) => ({
module.exports = ({ SRC_DIR } = {}) => ({
module: {
rules: [
{
test: /\.(jsx|js)?$/,
include: [SRC_DIR],
// use: [babelLoaderResolve]
use: [tsLoaderResolve]
},
{
test: /\.(sa|sc)ss$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
use: [MiniCssExtractPlugin.loader, cssLoaderResolve, sassLoaderResolve]
}
]
},
Expand Down
27 changes: 0 additions & 27 deletions config/webpack.prod.config.js

This file was deleted.

55 changes: 0 additions & 55 deletions config/webpack.proxy.config.js

This file was deleted.

46 changes: 46 additions & 0 deletions fec.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const path = require('path');
const { webpack, CopyWebpackPlugin } = require('weldable/lib/packages');
const { dotenv } = require('weldable');

const {
// DEV_BRANCH,
_BUILD_DIST_DIR: DIST_DIR,
_BUILD_STATIC_DIR: STATIC_DIR,
HOT: _INSIGHTS_HOT,
PROXY_VERBOSE: _INSIGHTS_PROXY_VERBOSE,
REACT_APP_ENV: DOTENV_ENV
} = dotenv.setupDotenvFilesForEnv({ env: (process.env.NODE_ENV === 'development' && 'proxy') || process.env.NODE_ENV });

module.exports = {
appUrl: '/subscriptions/usage',
debug: true,
// env: (/(prod|stage|qa|ci)(-stable|-beta)$/.test(DEV_BRANCH) && DEV_BRANCH) || 'stage-stable',
useProxy: true,
proxyVerbose: _INSIGHTS_PROXY_VERBOSE === 'true',
interceptChromeConfig: false,
plugins: [
new webpack.IgnorePlugin({ resourceRegExp: /\.(md)$/ }),
...dotenv.setupWebpackDotenvFilesForEnv({ env: DOTENV_ENV }),
new CopyWebpackPlugin({
patterns: [{ from: path.join(STATIC_DIR, 'locales'), to: path.join(DIST_DIR, 'locales'), noErrorOnMissing: true }]
})
],
...(() => {
if (_INSIGHTS_HOT === 'true') {
return { _unstableHotReload: true };
}
return undefined;
})(),
moduleFederation: {
exclude: ['react-router-dom'],
shared: [
{
'react-router-dom': {
singleton: true,
import: false,
version: '^6.3.0'
}
}
]
}
};
Loading

0 comments on commit 396c31c

Please sign in to comment.