When it comes to compiling, I prefer using webpack with TypeScript files.
In my webpack.config.js file:
module.exports = async (env, options) => {
const dev = options.mode === "development";
const config = {
//Webpack configuration properties
};
return config;
};
After running 'npm run server', I encountered the following issue:
ERROR in Error: Child compilation failed: Module not found: Error: Can't resolve '../loginfile.js' in '/Users/username/summarizr2/summarizr/src/login'
ModuleNotFoundError: Module not found: Error: Can't resolve '../loginfile.js' in '/Users/username/summarizr2/summarizr/src/login'
A similar problem also occurs with the logoutfile. In an HTML file, I have the following code:
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<!-- Office JavaScript API -->
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
<script type="text/javascript" src="../loginfile.js"></script>
</head>
I've attempted variations such as
<script type="text/javascript" src="./loginfile.js"></script>
and src="loginfile.ts"
The project structure is as follows:
├ src
│ ├ commands
│ │ ├ commands.html
│ │ ├ commands.ts
│ ├ constants
│ │ ├ authentication.ts
│ ├ login
│ │ ├ loginfile.html
│ │ ├ loginfile.ts
│ ├ logout
│ │ ├ logoutfile.html
│ │ ├ logoutfile.ts
│ ├ services
│ │ ├ commands
│ │ ├ common
│ ├ taskpane
│ │ ├ components
│ │ ├ endlogout.html
│ │ ├ index.css
│ │ ├ index.tsx
│ │ ├ login.html
│ │ ├ logoutcomplete
│ │ ├ taskpane.html
│ │ ├ urls.ts
├ tailwind.config.js
├ tsconfig.json
└ webpack.config.js
What could be causing this issue?
To simplify, let's consider a scenario where I have a test.ts file and test.html file located in src/test folder. The test.html file contains:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<script type="text/javascript" defer src="test.js"></script>
</head>
<body>
</body>
</html>
An error message such as the one below is displayed:
- ModuleNotFoundError: Module not found: Error: Can't resolve './test.js' in '/Users/*****/****/summarizr2/summarizr/src/test'
In my understanding, the test.js file should be located in the dist folder.