@elisha_langworth
To import an HTML file using webpack, you can use the html-loader
plugin. Here's how you can do it:
1
|
npm install --save-dev html-loader |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
module.exports = { module: { rules: [ { test: /.(html)$/, use: { loader: 'html-loader', options: { minimize: true, }, }, }, ], }, }; |
1
|
import html from './index.html'; |
Webpack will automatically bundle and include the HTML file in your output when you build your project.
That's it! Now you can import HTML files using webpack in your project.