I've tried to included ID5 into a bundle install through NPM, however, where facing the following issue when running webpack.
asset loader.js 101 KiB [compared for emit] (name: main)
runtime modules 670 bytes 3 modules
modules by path ./node_modules/@id5io/id5-api.js/lib/ 76.5 KiB
./node_modules/@id5io/id5-api.js/lib/id5-api.js 11.3 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/utils.js 12.3 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/refererDetection.js 5.66 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/clientStore.js 7.04 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/consentManagement.js 19.5 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/localStorage.js 3.25 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/id5Status.js 9.96 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/config.js 7 KiB [built] [code generated]
./node_modules/@id5io/id5-api.js/lib/constants.json 446 bytes [built] [code generated]
./src/app.js 160 bytes [built] [code generated]
./node_modules/@id5io/id5-api.js/generated/version.js 59 bytes [built] [code generated]
ERROR in ./node_modules/@id5io/id5-api.js/lib/config.js 4:0-86
Module not found: Error: Can't resolve './utils' in '/Users/gabrielchicoye/Dropbox/nexx360/dev/id5/node_modules/@id5io/id5-api.js/lib'
Did you mean 'utils.js'?
BREAKING CHANGE: The request './utils' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@id5io/id5-api.js/lib/id5-api.js 19:0-33 66:25-31
@ ./src/app.js 1:0-35 3:15-23
ERROR in ./node_modules/@id5io/id5-api.js/lib/id5Status.js 6:0-33
Module not found: Error: Can't resolve './utils' in '/Users/gabrielchicoye/Dropbox/nexx360/dev/id5/node_modules/@id5io/id5-api.js/lib'
Did you mean 'utils.js'?
BREAKING CHANGE: The request './utils' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@id5io/id5-api.js/lib/id5-api.js 16:0-39 76:32-41
@ ./src/app.js 1:0-35 3:15-23
ERROR in ./node_modules/@id5io/id5-api.js/lib/id5Status.js 9:0-30
Module not found: Error: Can't resolve './config' in '/Users/gabrielchicoye/Dropbox/nexx360/dev/id5/node_modules/@id5io/id5-api.js/lib'
Did you mean 'config.js'?
BREAKING CHANGE: The request './config' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@id5io/id5-api.js/lib/id5-api.js 16:0-39 76:32-41
@ ./src/app.js 1:0-35 3:15-23
3 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.67.0 compiled with 3 errors in 198 ms
"dependencies": {
"@id5io/id5-api.js": "^1.0.11"
},
"devDependencies": {
"webpack": "^5.67.0",
"webpack-cli": "^4.9.2"
}
import ID5 from '@id5io/id5-api.js'
const status = ID5.init({ partner: 173 });
status.onAvailable((id5Status) => {
console.log(id5Status.getUserId());
});
/* eslint-disable quotes */
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src/app.js',
output: {
filename: 'loader.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new webpack.DefinePlugin({
process: {
env: {
BUILD_DATE: `"${Date(Date.now()).toLocaleString()}"`,
},
},
}),
],
// mode: 'development',
// mode: 'production',
};