I'm currently working on a library project that involves utilizing p5.js.
Specifications
Here is a snippet of my Webpack configuration:
const path = require('path');
module.exports = {
entry: './start.ts',
output: {
filename: 'start.js',
path: path.resolve(__dirname, 'out'),
libraryTarget: "var",
library: "at",
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
module: {
rules: [
{
test: /\.ts$/,
loader: "awesome-typescript-loader"
}
]
}
};
This is how my package.json
looks like:
{
...,
"scripts": {
"build": "./node_modules/.bin/webpack --config webpack.config.js"
},
"devDependencies": {
"awesome-typescript-loader": "5.0.0",
"typescript": "2.8.3",
"webpack": "4.9.1",
"webpack-cli": "2.1.4"
},
"dependencies": {
"p5": "0.6.1"
}
}
To incorporate typescript, I've configured my tsconfig.json
as follows:
{
"compilerOptions": {
"noImplicitAny": true,
"noEmit": true,
"sourceMap": true,
"target": "es5",
"module": "es2015",
"lib": [ "dom", "es5" ],
"baseUrl": "."
},
"include": [
"start.ts",
],
"exclude": [
"out"
]
}
The entry point in start.ts
is defined like this:
import * as p5 from "p5";
class entry {
// Some
}
Issue
I'm encountering an issue with finding p5
in IntelliSense using VSCode. Upon running npm run build
, the following error occurs:
> webpack --config webpack.config.js
[at-loader] Using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="22565b52475141504b525662100c1a0c11">[email protected]</a> from typescript and "tsconfig.json" from C:\Users\me\Documents\GitHub\myproj/tsconfig.json.
... (additional warning and error messages)
ERROR in [at-loader] ./start.ts:1:21
TS2307: Cannot find module 'p5'.
... (more npm error logs)
Can anyone provide insight into what might be causing this issue?