something is wrong with the webpack@4.x project
Wxh16144 opened this issue · comments
Hello great developers.
I'm having some problems with my project. As far as I can see it might be caused by the recent update of this repository.
My project is using webpack4
and due to the change of type
from module
to commonjs
in 3.0.8
version I am getting an error in my console. And the build is also affected. I switched to 3.0.7
and I don't have this error anymore.
At first I thought it was a breaking change in compute-scroll-into-view
that was causing it. It doesn't look like that.
I would like to know the reason for this adjustment. The ant-design repository is also affected. Although I can fix the problem by locking the version. But I would like to give you feedback and get your suggestions.
cc @long76
Hi, try #1163 (comment)
Please get me reply
I noticed that, but I think type="module"
should be the correct fix, otherwise it's a BREAKING CHANGE!
cc @long76
Hi, try #1163 (comment)
Please get me replyI noticed that, but I think
type="module"
should be the correct fix, otherwise it's a BREAKING CHANGE!
it's breaking change only for webpack users which not set config for response .mjs
my test app without webpack on TS work correctly. but i agree that the last change broke app on webpack where don't hardcoded version of this library.
for users i see a few variants:
- use hardcoded version(library not in active development and stable for are while)
- make branch
3.0.x
, revert my changes, release and release main branch as3.1.0
(too for https://github.com/scroll-into-view/compute-scroll-into-view) - just edit your
webpack.config.js
like here #1163 (comment)
@Wxh16144 and fix for antd is ready ant-design/antd-tools#272
check third solution on antd
work correctly
before fix in antd-tools
C:\ant-design>npm run dist
> antd@5.4.0 predist
> npm run version
> antd@5.4.0 version
> node ./scripts/generate-version
> antd@5.4.0 dist
> antd-tools run dist
Execute: dist - {}
- Args: {}
× 🚚 Ant Design Tools
Compiled with some errors in 2.99m
Webpack Bundle Analyzer saved report to C:\ant-design\report.html
(node:8160) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
at emitMakeCallbackDeprecation (node:domain:143:13)
at process.topLevelDomainCallback (node:domain:157:5)
at process.callbackTrampoline (node:internal/async_hooks:128:24)
* 🚚 Ant Design Tools █████████████████████████ after chunk asset optimization (93%) SourceMapDevToolPlugin
Error parsing bundle asset "C:\ant-design\dist\antd-with-locales.min.js": no such file
Error parsing bundle asset "C:\ant-design\dist\antd.min.js": no such file
No bundles were parsed. Analyzer will show only original module sizes from stats file.
Webpack Bundle Analyzer saved report to C:\ant-design\report.html
(undefined) ./node_modules/scroll-into-view-if-needed/dist/index.mjs 1:457-458
Can't import the named export 'compute' from non EcmaScript module (only default export is available)
at HarmonyImportSpecifierDependency._getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:88:6)
at HarmonyImportSpecifierDependency.getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:68:16)
at Compilation.reportDependencyErrorsAndWarnings (C:\ant-design\node_modules\webpack\lib\Compilation.js:1463:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1258:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
at AsyncSeriesHook.lazyCompileHook (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
at Compilation.finish (C:\ant-design\node_modules\webpack\lib\Compilation.js:1253:28)
at C:\ant-design\node_modules\webpack\lib\Compiler.js:672:17
at _done (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at eval (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:32:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1185:12
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1097:9
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
@ ./components/anchor/Anchor.tsx
@ ./components/anchor/index.ts
@ ./components/index.ts
@ ./index-with-locales.js
(undefined) ./node_modules/scroll-into-view-if-needed/dist/index.mjs 1:547-548
Can't import the named export 'compute' from non EcmaScript module (only default export is available)
at HarmonyImportSpecifierDependency._getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:88:6)
at HarmonyImportSpecifierDependency.getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:68:16)
at Compilation.reportDependencyErrorsAndWarnings (C:\ant-design\node_modules\webpack\lib\Compilation.js:1463:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1258:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
at AsyncSeriesHook.lazyCompileHook (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
at Compilation.finish (C:\ant-design\node_modules\webpack\lib\Compilation.js:1253:28)
at C:\ant-design\node_modules\webpack\lib\Compiler.js:672:17
at _done (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at eval (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:32:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1185:12
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1097:9
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
@ ./components/anchor/Anchor.tsx
@ ./components/anchor/index.ts
@ ./components/index.ts
@ ./index-with-locales.js
(undefined) ./node_modules/scroll-into-view-if-needed/dist/index.mjs 1:457-458
Can't import the named export 'compute' from non EcmaScript module (only default export is available)
at HarmonyImportSpecifierDependency._getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:88:6)
at HarmonyImportSpecifierDependency.getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:68:16)
at Compilation.reportDependencyErrorsAndWarnings (C:\ant-design\node_modules\webpack\lib\Compilation.js:1463:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1258:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:20:1)
at AsyncSeriesHook.lazyCompileHook (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
at Compilation.finish (C:\ant-design\node_modules\webpack\lib\Compilation.js:1253:28)
at C:\ant-design\node_modules\webpack\lib\Compiler.js:672:17
at _done (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at eval (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:32:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1185:12
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1097:9
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
@ ./components/anchor/Anchor.tsx
@ ./components/anchor/index.ts
@ ./components/index.ts
@ ./index-with-locales.js
(undefined) ./node_modules/scroll-into-view-if-needed/dist/index.mjs 1:547-548
Can't import the named export 'compute' from non EcmaScript module (only default export is available)
at HarmonyImportSpecifierDependency._getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:88:6)
at HarmonyImportSpecifierDependency.getErrors (C:\ant-design\node_modules\webpack\lib\dependencies\HarmonyImportSpecifierDependency.js:68:16)
at Compilation.reportDependencyErrorsAndWarnings (C:\ant-design\node_modules\webpack\lib\Compilation.js:1463:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1258:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:20:1)
at AsyncSeriesHook.lazyCompileHook (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
at Compilation.finish (C:\ant-design\node_modules\webpack\lib\Compilation.js:1253:28)
at C:\ant-design\node_modules\webpack\lib\Compiler.js:672:17
at _done (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at eval (eval at create (C:\ant-design\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:32:22)
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1185:12
at C:\ant-design\node_modules\webpack\lib\Compilation.js:1097:9
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
@ ./components/anchor/Anchor.tsx
@ ./components/anchor/index.ts
@ ./components/index.ts
@ ./index-with-locales.js
after fix
C:\ant-design>npm run dist
> antd@5.4.0 predist
> npm run version
> antd@5.4.0 version
> node ./scripts/generate-version
> antd@5.4.0 dist
> antd-tools run dist
Execute: dist - {}
- Args: {}
√ 🚚 Ant Design Tools
Compiled successfully in 2.93m
Webpack Bundle Analyzer saved report to C:\ant-design\report.html
(node:9492) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
at emitMakeCallbackDeprecation (node:domain:143:13)
at process.topLevelDomainCallback (node:domain:157:5)
at process.callbackTrampoline (node:internal/async_hooks:128:24)
√ 🚚 Ant Design Tools
Webpack Bundle Analyzer saved report to C:\ant-design\report.html
Child
Time: 287847ms
Built at: 09.04.2023 13:55:46
Asset Size Chunks Chunk Names
antd-with-locales.min.js 1.53 MiB 0 [emitted] [big] antd-with-locales.min
antd-with-locales.min.js.map 5.91 MiB 0 [emitted] [dev] antd-with-locales.min
antd.min.js 1.27 MiB 1 [emitted] [big] antd.min
antd.min.js.map 5.35 MiB 1 [emitted] [dev] antd.min
Entrypoint antd.min [big] = antd.min.js antd.min.js.map
Entrypoint antd-with-locales.min [big] = antd-with-locales.min.js antd-with-locales.min.js.map
Child
Time: 176006ms
Built at: 09.04.2023 13:53:56
Asset Size Chunks Chunk Names
antd-with-locales.js 8.36 MiB antd-with-locales [emitted] [big] antd-with-locales
antd-with-locales.js.map 7.58 MiB antd-with-locales [emitted] [dev] antd-with-locales
antd.js 7.76 MiB antd [emitted] [big] antd
antd.js.map 6.94 MiB antd [emitted] [dev] antd
Entrypoint antd [big] = antd.js antd.js.map
Entrypoint antd-with-locales [big] = antd-with-locales.js antd-with-locales.js.map
[Dist] Finalization...
try find another solution
@Wxh16144 @stipsan it's my mistake sorry for that, PR is ready:
compute-scroll-into-view scroll-into-view/compute-scroll-into-view#891
scroll-into-view-if-needed #1183
Respect~