I try to build TypeScript code for html viewing, I have the following code: console.log('hello world'); After building code with "yarn build", "node ./node_modules/webpack/bin/webpack --mode development" run it with "node ./node_modules/webpack-dev-server/bin/webpack-dev-server --mode development " Also html file generated by builder is included in src directory and webpackbundle.js is also there:
<!DOCTYPE html>
<html>
<head>
<title>Canvas demo</title>
<script defer src="webpackbundle.js"></script></head>
<body>
<script src="webpackbundle.js"></script>
<p id="clear">above</p>
</body>
</html>
But after running there is no expected output "hello world" on html, only "above" as stated as initial html, so it seems that app isn't viewed by running html
My webpack.config.js loks like:
var HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require("path");
module.exports = {
mode: "development",
devtool: "source-map",
entry: './game.tsx',
output: {
path : path.resolve(__dirname, 'src'),
filename: 'webpackbundle.js'
},
...
plugins: [new HtmlWebpackPlugin({
path : path.resolve(__dirname, 'src'),
template: "index.html",
hash: true, // This is useful for cache busting
filename: 'index.html'
})]
} //also have rules for typescript and resolve, port specification
In src webpackbundle.js.map is generated and webpackbundle.js has corresponding console.log('hello world') code, but there is no related output in html
Could anybody advise on how to make code output visible in html?