如何使用webpack 4将tippy.js导入html页面? [英] How to import tippy.js into an html page with webpack 4?

查看:278
本文介绍了如何使用webpack 4将tippy.js导入html页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在tippy.js git中心页面上,我使用npm安装了它:

Per the tippy.js git hub page I installed it with npm:

npm i tippy.js

现在我有一个.js源文件,该文件用于webpack 4 html页面,该页面输出到我的./dist文件夹,但是我不知道如何导入它.我的另一种选择是仅将其包含在CDN中,但这似乎不是webpackesque

Now I have a .js source file that's used for a webpack 4 html page that gets output to my ./dist folder, but I don't know how to import it; my other option is just to include it from the CDN but that doesn't seem very webpackesque

我也正在通过babel-loader stage-0使用ES6;那么我该如何准确地导入它,使其包含在我的捆绑软件中?

Also I'm using ES6 via babel-loader stage-0; so how exactly do I import that in so it's included with my bundle?

是否也需要导入小费的CSS?

Shouldn't the CSS for tippy need to be imported as well?

推荐答案

好吧,我在在这里找到了

import tippy from 'tippy.js'

对于CSS是

import 'tippy.js/dist/tippy.css'

这篇关于如何使用webpack 4将tippy.js导入html页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆