GithubHelp home page GithubHelp logo

Fix support for Webpack about notyf HOT 3 CLOSED

caroso1222 avatar caroso1222 commented on July 30, 2024
Fix support for Webpack

from notyf.

Comments (3)

caroso1222 avatar caroso1222 commented on July 30, 2024 3

@preeteshjain

TL;DR
It's fixed. Now you can import Notyf via var Notyf = required('notyf')

Some thoughts
The problem was you weren't specifying which particular file you were trying to require the module from. I tried var Notyf = require('notyf/src/notyf') and worked like a charm. I know this not as clean as we would like to import our modules, so I added the module export at the entry point. I created a Vue project using vue-cli with webpack as the template and successfully imported Notyf this way:

var Notyf = require('notyf')
import 'notyf/dist/notyf.min.css'
var notyf = new Notyf()
notyf.alert('Please fill out the form')

screen shot 2017-02-19 at 12 25 35 pm

from notyf.

caroso1222 avatar caroso1222 commented on July 30, 2024

I've never worked with Vue but I'm going to take a look at it.

from notyf.

preeteshjain avatar preeteshjain commented on July 30, 2024

Yes, I too think var Notyf = require('notyf/src/notyf') is not a good approach.

Anyway, I'm glad that now it works as expected.

from notyf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.