-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues when importing some functions from NcRichText.js #3864
Comments
I went through the (dev)dependencies list of
are not present in It would probably help to know which package includes |
@julien-nc I'm unable to reproduce this issue with either your branch of integration_tmdb and with collectives. I did the following:
Anything I'm missing? 🤔 |
I've tried it with server stable26 and master in Talk and Text: not working. |
Just sharing the screenshot I took when checking this a bit with @julien-nc It was util -> console-browserify -> assert trying to call this My first thought was that https://www.npmjs.com/package/node-polyfill-webpack-plugin was missing but adding didn't make any difference. |
Also worth to mention that this doesn't happen in server with nextcloud/server#33755 |
I could reproduce this locally with using Failing upstream lines in the trace Steps to use npm pack
|
@ShGKme Hey, do you have any clue about that? Could it be caused by the webpack config in nextcloud/vue and how the package is built? |
better late than never
Short answer:
The difference between "The library" and "The folder with the library" is the dependency resolving:
So, if some lib is a dependency of your app and your app's other libs and also a devDependency of the lib. Right now I cannot say what exactly caused the problem. But I'm sure for 75%, that the problem is around wrong I will look into the reproduction repo. |
Sooo. I could reproduce it and found the problem after some funny hours. Preface
Why it fails
// 📁 browserify/commonjs-assert/assert.js
const { inspect } = require('util')
// While `util` is in process of evaluating, util = {}, inspect === undefined
// Later `util` will be evaluated. But `inspect` will remain undefined. Why it worksIt is enough to evaluate
How to solve the problem
// 📁 webpack.config.js
const webpackConfig = {
plugins: [
// ... other plugins ...
- new NodePolyfillPlugin()
+ new NodePolyfillPlugin({
+ excludeAliases: ['console']
+ })
// ... other plugins ...
]
} Workaround for // 📁 webpack.js
// eslint-disable-next-line n/no-extraneous-require
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
webpackConfig.plugins[1] = new NodePolyfillPlugin({
excludeAliases: ['console'],
}) Note
|
@ShGKme Thank you so much for the effort! You 🎸. |
It is not related to |
I'm closing the issue as it is not |
When importing
registerWidget
,registerCustomPickerElement
orNcCustomPickerRenderResult
from@nextcloud/vue/dist/Components/NcRichText.js
the script fails and we getUncaught TypeError: inspect is undefined
in the browser console:But this error goes away as soon as we import something from
@nextcloud/vue-richtext
, even an empty import likeimport {} from '@nextcloud/vue-richtext'
.This issue cannot be reproduced when linking with
@nextcloud/vue
(same with master or v7.8.0, it works fine).So it seems there are some missing dependencies in the
@nextcloud/vue
package. Or can it be related with node-polyfill? I'm lost there.To reproduce this bug, one can use this integration_tmdb branch: https://github.com/julien-nc/integration_tmdb/tree/enh/noid/replace-vue-richtext-by-vue , compile and enable the app in NC 26 or master and browse Talk or the Files app (with Text enabled).
The problematic import is in https://github.com/julien-nc/integration_tmdb/blob/enh/noid/replace-vue-richtext-by-vue/src/reference.js#L23-L24
cc @raimund-schluessler @juliushaertl
The text was updated successfully, but these errors were encountered: