I am trying to set a simple testing environment for PIXI js but the console debuger chokes at the import from PIXI
Uncaught TypeError: Failed to resolve module specifier "pixi.js". Relative references must start with either "/", "./", or "../".
Pixi.js has been installed with npm install pixi.js I am not experienced with webpack but it seems to be the problem.
index.html :
<!DOCTYPE html>
<html>
<head>
<title>Pixel Animator</title>
<meta charset="UTF-8" />
</head>
<body>
<script type="module" src="index.js"></script>
</body>
</html>
index.js :
import * as PIXI from "pixi.js"
...
webpack.config.js :
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/app.js',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'app.js'
},
devServer: {
contentBase: './dist'
},
plugins: [
new CopyPlugin([
{ from: 'src/index.html', to: './' },
{ from: 'src/style.css', to: './' },
]),
],
};
Any idea what causes this to happen ?