Reputation: 8498
I try to load my index.html
file via the file-loader
and Webpack 3.
My webpack.config.ts
looks like this:
import * as webpack from 'webpack';
const config: webpack.Configuration = {
entry: "./src/app.tsx",
output: {
filename: "bundle.js",
path: __dirname + "/dist"
},
devtool: "source-map",
resolve: {
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js", ".html"]
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader"
}, {
test: /\.html$/,
loader: "file-loader"
}
]
}
};
export default config;
Unfortunately it doesn't load my src/index.html
file to the dist
folder. What am I doing wrong? How can I get the index file from the src
folder to the dist
folder?
Upvotes: 2
Views: 1288
Reputation: 4452
You can use html-webpack-plugin
.
{
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
}
Upvotes: 2