Aha! It’s working! Just had to add commonjs as a module to my .babelrc!
Still curious why cfg.output isn’t available in extendWebpack, but obviously it’s not so urgent feeling now.
Now I can go to bed.
Aha! It’s working! Just had to add commonjs as a module to my .babelrc!
Still curious why cfg.output isn’t available in extendWebpack, but obviously it’s not so urgent feeling now.
Now I can go to bed.
Thanks for the tip! And I’ll make sure to check out the discord server, I’ve been meaning to anyway.
@metareason Sure thing, hope it helps you!
{
“presets”: [
[
“@babel/preset-env”, {
“modules”: “commonjs”,
“loose”: false,
“useBuiltIns”: “usage”
}
],
[
“@babel/preset-stage-2”, {
“modules”: “commonjs”,
“loose”: false,
“useBuiltIns”: true,
“decoratorsLegacy”: true
}
]
],
“plugins”: [
[
“@babel/transform-runtime”, {
“polyfill”: false,
“regenerator”: false
}
]
],
“comments”: false
}
Thanks for the suggestion! Unfortunately, it didn’t seem to make a difference.
Hello!
Ever since I upgraded from 0.17 to v1, when I try to use the javascript debugger in Chrome, the quasar code is minified, which is making it hard to figure out some of my problems. I’m not that familiar with webpack, but I think this means source maps aren’t working properly? I’m launching quasar with “quasar dev”.
Oddly enough, Chrome thinks it is showing me the source map. The subtitle in the code window reads “source mapped from quasar.esm.js” but it’s minified/uglified.
Anyone know what’s going on?
Thanks!
-Jenny
My specs in case it’s helpful:
Mac OSX Mojave
Chrome: Version 75.0.3770.100 (Official Build) (64-bit)
Operating System - Darwin(18.5.0) - darwin/x64
NodeJs - 11.15.0
Global packages
NPM - 6.9.0
yarn - Not installed
@quasar/cli - 1.0.0-rc.2
cordova - Not installed
Important local packages
quasar - 1.0.0-rc.5 -- High performance, Material Design 2, full front end stack with Vue.js -- build SPA, SSR, PWA, Hybrid Mobile Apps and Electron apps, all simultaneously using the same codebase
@quasar/app - 1.0.0-rc.7 -- Quasar Framework App CLI
@quasar/extras - 1.1.4 -- Quasar Framework fonts, icons and animations
vue - 2.6.10 -- Reactive, component-oriented view layer for modern web interfaces.
vue-router - 3.0.6 -- Official router for Vue.js 2
vuex - 3.1.1 -- state management for Vue.js
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
@babel/core - 7.4.5 -- Babel compiler core.
webpack - 4.34.0 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
webpack-dev-server - 3.7.2 -- Serves a webpack app. Updates the browser on changes.
workbox-webpack-plugin - 4.3.1 -- A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.
register-service-worker - 1.6.2 -- Script for registering service worker, with hooks
Quasar App Extensions
*None installed*
With the upgrade to quasar v1 I thought I’d post my new babel config file here, in case it might be of help to anyone searching the interwebs.
“modules” is now deprecated in babel configuration. But, instructions are given here: https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
So my new babel.config.js is now:
module.exports = {
presets: [
‘@quasar/babel-preset-app’,
{
‘plugins’: [’@babel/plugin-transform-modules-commonjs’]
}
]
}
Cheers
@metareason Sure thing, hope it helps you!
{
“presets”: [
[
“@babel/preset-env”, {
“modules”: “commonjs”,
“loose”: false,
“useBuiltIns”: “usage”
}
],
[
“@babel/preset-stage-2”, {
“modules”: “commonjs”,
“loose”: false,
“useBuiltIns”: true,
“decoratorsLegacy”: true
}
]
],
“plugins”: [
[
“@babel/transform-runtime”, {
“polyfill”: false,
“regenerator”: false
}
]
],
“comments”: false
}
Thanks for the tip! And I’ll make sure to check out the discord server, I’ve been meaning to anyway.
Aha! It’s working! Just had to add commonjs as a module to my .babelrc!
Still curious why cfg.output isn’t available in extendWebpack, but obviously it’s not so urgent feeling now.
Now I can go to bed.
Hi! Trying to get moved over to using quasar-cli with an existing project and running into some difficulties. Specifically, the project uses module.exports for some files shared by a node.js backend and a quasar frontend. But this makes webpack not happy:
Uncaught TypeError: Cannot assign to read only property ‘exports’ of object ‘#<Object>’
I understand that you can’t import a file that uses module.exports, you have to require it instead. But I am requiring it and am still getting this error.
If only I could switch everything to import/export! But then node.js isn’t happy. Support of import/export on node is extremely experimental, only on the bleeding edge of node.js, and requires a .mjs extension. Or at least that’s as far as I read before I thought… there must be a better way!
So, I’ve been flailing around for a while trying to figure out how to make this work. It was working with my old setup (had installed quasar-framework as a vue cli 3 plugin) that used webpack 3.7.1. I’ve tried a few different versions of webpack 4.x (saw a bug in a recent release that I thought might be related to the issue), but none are working. Avoiding switching back to 3.7.1 because I’m worried it might break lots of things that quasar-cli might need. I’m currently on webpack 4.16.1
While in my crazed search for anything that might help, I saw a suggestion to try setting webpack’s output.libraryExport setting to default. So I wanted to try it. But I can’t. I’m trying to do this within quasar.conf.js’s build.extendWebpack with the following line:
cfg.output.libraryExport(‘default’)
Which as far as I can tell should be valid from the webpack-chain API, but cfg.output is null. Is cfg.output restricted for some reason? Am I too far down the chain to access it or something? I don’t know. I’m used to the standard webpack conf files, webpack-chain is magic as far as I know. I don’t have much hope that this will work anyway, but I would love to try it.
Please save me from having to copy a bunch of common files into a new location to change just one line, and from then on forevermore have to maintain both copies. It makes my DRY programmer heart want to gag.
Thank you for reading. This has been a little cathartic.
-Jenny