Closed Hypnosphi closed 3 years ago
Should be fixed in 3.0.2
, thanks.
Webpack is fine in 3.0.2
, but we're still receiving errors in Jest from a unit that imports arrayMove
.
/Users/darin/git/traverse/frontend/node_modules/react-movable/lib/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import List from './List.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
1 | import PropTypes from 'prop-types'
2 | import { useState } from 'react'
> 3 | import { arrayMove } from 'react-movable'
| ^
Adding react-movable to Jest's transformIgnorePatterns
doesn't work in this case.
Jest also supports ESM with some extra settings: https://jestjs.io/docs/ecmascript-modules
They do, as experimental support. It does not work (at least for our codebase)
@tajo This issue reappears in the latest 3.0.3
. I had to install 3.0.2
instead.
ERROR in ./node_modules/react-movable/lib/index.js 1:0-26
Module not found: Error: Can't resolve './List' in '/Users/*/node_modules/react-movable/lib'
Did you mean 'List.js'?
BREAKING CHANGE: The request './List' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
ERROR in ./node_modules/react-movable/lib/index.js 2:0-49
Module not found: Error: Can't resolve './utils' in '/Users/*/node_modules/react-movable/lib'
Did you mean 'utils.js'?
BREAKING CHANGE: The request './utils' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@linhpham199 3.0.4
should be fine now
When trying to use 3.0.1 in a webpack project:
you should probably add extension to all imports, as stated here: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm