initialised commit on the ui converted in mui to astryx and changed the design to doormile
This commit is contained in:
@@ -2,6 +2,54 @@ const webpack = require('webpack');
|
||||
const WorkBoxPlugin = require('workbox-webpack-plugin');
|
||||
|
||||
module.exports = function override(config) {
|
||||
// @astryxdesign/core ships as ESM with relative imports missing extensions
|
||||
// (e.g. '../Tooltip/Tooltip'), which webpack 5 rejects under strict ESM
|
||||
// resolution. Relax it for this package only rather than globally.
|
||||
config.module.rules.push({
|
||||
test: /\.m?js$/,
|
||||
include: /node_modules[\\/]@astryxdesign/,
|
||||
resolve: { fullySpecified: false }
|
||||
});
|
||||
|
||||
// react-scripts routes all other node_modules JS through
|
||||
// babel-preset-react-app/dependencies (a lighter preset than the one used
|
||||
// for src/), which doesn't include the import-attributes syntax plugin.
|
||||
// @astryxdesign/core's i18n module uses `import x from './en.json' with
|
||||
// { type: 'json' }` — the webpack version react-scripts@5 bundles predates
|
||||
// native import-attributes support, so even once Babel can *parse* that
|
||||
// syntax (via the syntax plugin) it still needs to be stripped from the
|
||||
// output, or webpack's own parser trips on the untouched `with {...}`
|
||||
// clause in babel-loader's output. Insert a dedicated oneOf rule ahead of
|
||||
// the generic node_modules js/mjs rule — oneOf rules are mutually
|
||||
// exclusive (first match wins), so the generic rule won't also try to
|
||||
// process these files.
|
||||
const stripImportAttributes = () => ({
|
||||
visitor: {
|
||||
ImportDeclaration(path) {
|
||||
if (path.node.attributes) path.node.attributes = [];
|
||||
if (path.node.assertions) path.node.assertions = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
const oneOfRule = config.module.rules.find((rule) => Array.isArray(rule.oneOf));
|
||||
if (oneOfRule) {
|
||||
oneOfRule.oneOf.unshift({
|
||||
test: /\.m?js$/,
|
||||
include: /node_modules[\\/]@astryxdesign/,
|
||||
resolve: { fullySpecified: false },
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
compact: false,
|
||||
presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],
|
||||
plugins: [require.resolve('@babel/plugin-syntax-import-attributes'), stripImportAttributes],
|
||||
cacheDirectory: true,
|
||||
cacheCompression: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
config.resolve.fallback = {
|
||||
process: require.resolve('process/browser'),
|
||||
// zlib: require.resolve('browserify-zlib'),
|
||||
|
||||
Reference in New Issue
Block a user