-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: π React 18 strict mode double animation (#94)
* fix: π React 18 strict mode double animation * chore: π€ changeset Co-authored-by: SamuelOsborne <samu.osborne@gmail.com>
- Loading branch information
1 parent
8a7a6a6
commit 32e0728
Showing
15 changed files
with
9,146 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@lottiefiles/react-lottie-player': patch | ||
--- | ||
|
||
fix double animation with react 18 strict mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,16 @@ | ||
const path = require('path'); | ||
|
||
/* Allows importing code from other packages in a monorepo. Explanation: | ||
When you use lerna / yarn workspaces to import a package, you create a symlink in node_modules to | ||
that package's location. By default Webpack resolves those symlinks to the package's actual path, | ||
which makes some create-react-app plugins and compilers fail (in prod builds) because you're only | ||
allowed to import things from ./src or from node_modules | ||
*/ | ||
const disableSymlinkResolution = { | ||
plugin: { | ||
overrideWebpackConfig: ({ webpackConfig }) => { | ||
webpackConfig.resolve.symlinks = false; | ||
return webpackConfig; | ||
}, | ||
}, | ||
}; | ||
|
||
const webpackSingleModulesResolution = { | ||
configure: { | ||
resolve: { | ||
symlinks: false, | ||
modules: [ | ||
path.resolve('../../dist/lottie-react.js'), | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
const eslintOff = { | ||
enable: false | ||
} | ||
|
||
const path = require('path') | ||
const CracoAlias = require("craco-alias"); | ||
|
||
module.exports = { | ||
plugins: [disableSymlinkResolution], | ||
webpack: webpackSingleModulesResolution, | ||
eslint: eslintOff | ||
}; | ||
plugins: [ | ||
{ | ||
plugin: CracoAlias, | ||
options: { | ||
unsafeAllowModulesOutsideOfSrc : true, | ||
aliases: { | ||
'@lottiefiles/react-lottie-player': path.resolve('../../dist/lottie-react.esm.js'), | ||
} | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.