Skip to content

Commit

Permalink
deps: use local preact
Browse files Browse the repository at this point in the history
chore: bump `@bpmn-io/properties-panel` test dependencies
  • Loading branch information
nikku committed Oct 16, 2023
1 parent 8758015 commit 0250c2c
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 367 deletions.
35 changes: 5 additions & 30 deletions karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

const path = require('path');
const {
DefinePlugin,
NormalModuleReplacementPlugin
DefinePlugin
} = require('webpack');

const basePath = '.';
Expand Down Expand Up @@ -75,7 +74,7 @@ module.exports = function(karma) {
options: {
plugins: [
[ '@babel/plugin-transform-react-jsx', {
'importSource': '@bpmn-io/properties-panel/preact',
'importSource': 'preact',
'runtime': 'automatic'
} ]
].concat(coverage ? [
Expand All @@ -95,30 +94,7 @@ module.exports = function(karma) {

// @barmac: process.env has to be defined to make @testing-library/preact work
'process.env': {}
}),
new NormalModuleReplacementPlugin(
/^preact(\/[^/]+)?$/,
function(resource) {

const replMap = {
'preact/hooks': path.resolve('node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js'),
'preact/jsx-runtime': path.resolve('node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js'),
'preact': path.resolve('node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js')
};

const replacement = replMap[resource.request];

if (!replacement) {
return;
}

resource.request = replacement;
}
),
new NormalModuleReplacementPlugin(
/^preact\/hooks/,
path.resolve('node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js')
)
})
],
resolve: {
mainFields: [
Expand All @@ -127,9 +103,8 @@ module.exports = function(karma) {
'main'
],
alias: {
'preact': '@bpmn-io/properties-panel/preact',
'react': '@bpmn-io/properties-panel/preact/compat',
'react-dom': '@bpmn-io/properties-panel/preact/compat'
'react': 'preact/compat',
'react-dom': 'preact/compat'
},
modules: [
'node_modules',
Expand Down
Loading

0 comments on commit 0250c2c

Please sign in to comment.