HTML 作为 Webpack 入口点 [英] HTML as Webpack entry point

查看:27
本文介绍了HTML 作为 Webpack 入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我对 Web 开发完全陌生,所以如果我的方法完全错误,请直说.

First of all, I'm completely new to web development so if my approach is totally wrong, just say so.

我想自动构建 sass 和 ts 文件,所以我阅读了有关 Gulp/Webpack 的信息,并且似乎 webpack 是要走的路.

I want to automate build of sass and ts files, so I read about Gulp/Webpack, and seems like webpack is the way to go.

我正在构建一个简单的单页网站,现在我只需要一个小的 javascript,所以我认为 webpack 的入口点应该是 html 文件本身是有道理的.但是,所有的文档和教程都只讨论从 .js 开始.

I am building a simple single page website and for now I only have a small javascript that's needed, so it makes sense in my mind that the entry point for webpack should be the html file itself. However, all the docs and tutorials only talk about starting from a .js.

有没有办法从 HTML 开始并解析 js、css、图片和其他需要的东西?

Is there a way to start from the HTML and resolve js, css, images and other required stuff?

我应该直接废弃使用 webpack 并使用 gulp 编译 typescript 和 sass 吗?

Should I just scrap using webpack and just use gulp to compile the typescript and sass?

推荐答案

另一种方法是使用 Parcel,它支持将 HTML 文件作为 entry.

One alternative would be to use Parcel, which supports having a HTML file as the entry.

这篇关于HTML 作为 Webpack 入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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