-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Buffer is not defined #1294
Comments
It related with new webpack that used in new quasar app. Just add @babel/core to dev dependencies and extend quasar webpack config by |
@scarry1992 thanks a lot for the solution! I did a |
in quasar.conf.js: |
After adding the config, I have a |
Yes, you should import webpack in quasar.config.js |
I have all kinds of issues after the import. Would you be interested in a reproducible case (step by step), or should I just give up? |
attach pls your quasar.config.js and package.json |
That`s I described helped me in my lib, but...first link in quasar repo issues: https://quasar.dev/start/upgrade-guide#nodejs-polyfills |
My quasar.conf.js looks different: // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
build: {
vueRouterMode: 'hash', // available values: 'hash', 'history'
// transpile: false,
// publicPath: '/',
// Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true.
// transpileDependencies: [],
// rtl: true, // https://quasar.dev/options/rtl-support
// preloadChunks: true,
// showProgress: false,
// gzip: true,
// analyze: true,
// Options below are automatically set depending on the env, set them if you want to override
// extractCSS: false,
// https://quasar.dev/quasar-cli/handling-webpack
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpack (chain) {
chain.plugin('eslint-webpack-plugin').use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }])
},
}, I'm new to quasar, and also new to mqttjs. So how do I add this line to my config?
Looks not really compatible ... [update] Ah, I think I got it: chainWebpack (chain) {
const nodePolyfillWebpackPlugin = require('node-polyfill-webpack-plugin')
chain.plugin('node-polyfill').use(nodePolyfillWebpackPlugin)
chain.plugin('eslint-webpack-plugin').use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }])
}, plus: npm install node-polyfill-webpack-plugin |
I use Vue CLI v5.0.0-beta.2 to build Vue 3 project and face the similar problem too.
yarn add --dev buffer process
const webpack = require(“webpack”);
module.export = {
...
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
],
},
} |
兄弟,有qq么,请教一下。 |
This is because some modules are no longer introduced after the webpack version ‘V5’, the purpose is to reduce the packaging volume. Do like this could solve you problem #1294 (comment) |
[Solved here] |
I have fixed Browser docs by adding webpack and vite setup. Check them out |
When importing MQTT.js to a VueJS/Quasar app, I get the following error:
I tried (more or less randomly, after finding a similar issue) to
which chnaged the error to
Please let me know if I can help with the debug.
The text was updated successfully, but these errors were encountered: