Using notify (especially in Laravel) (v0.15.2)



  • I am trying to use the new notify component in my laravel project.
    But nothing works:
    import {Notify} from “quasar-framework/dist/quasar.mat.esm”;
    If I try to use it like described in the documentation: Notify.create(‘bla’) nothing happens. No notification and no errors.

    Importing via import {Notify} from ‘quasar’ has never worked for any component (also before v0.15). I always needed to say from ‘quasar-framework’ or now in v0.15 'from “quasar-framework/dist/quasar.mat.esm”;

    Any idea?



  • Importing via import {Notify} from ‘quasar’ has never worked for any component (also before v0.15). I always needed to say from ‘quasar-framework’ or now in v0.15 'from “quasar-framework/dist/quasar.mat.esm”;

    Well, as someone pointed out here, import { Notify } from 'quasar should work: http://forum.quasar-framework.org/topic/1852/0-15-notify-with-html/2

    Still, i’m trying to understand how quasar succeed to resolve the dependency. As well, on root of a quasar projet, a .quasar folder is created with a file called entry.js there. As well, I don’t get how components are resolved from quasar dependency. Maybe @rstoenescu could explain us?



  • make sure you add Notify in quasar.conf.js:

    module.exports = function (ctx) {
      return {
        framework: {
          plugins: [ 'Notify' ]
        }
      }
    }
    

    Then in any .vue file:

    this.$q.notify('hello!')
    


  • @akaryatrh If you are interested in why import * from quasar works take a look here https://github.com/quasarframework/quasar-cli/blob/dev/lib/build/webpack-config.js#L87

    When you run quasar build, the Quasar CLI calls Webpack in order to bundle the files. In the versions before 0.15 the Webpack Config was explicitly written in the build folder. Since 0.15 the Webpack config is now provided by quasar-cli and merged with your changes during build.

    What you see in the line posted above is a so called Webpack alias. This allows for shorthand notations which will then be resolved by Webpack. So every time Webpack encounters quasar in an import statement it is replaced by the path to the quasar source.

    You can learn more about this feature here:
    https://webpack.js.org/configuration/resolve/

    Thanks to being able to extend the Webpack config in quasar.config.js you can even write your own aliases.



  • Hi @a47ae
    Thx for pointing the webpack conf of the CLI, i didn’t noticed these aliases 🙂