Enonic version: current
OS: WIN and macOS
I would like to use the webpack-starter for my “Backend”-part.
So I created a new project using the starter, deleted all client related stuff and ran a build successfilly.
Then I added the contextLib
in build.gradle
→ include "com.enonic.xp:lib-context:${xpVersion}"
In main.es6
I added the following line const contextLib = require('/lib/xp/context');
When I try to build the project I gett the following error:
ERROR in ./main.es6 2:17-43
Module not found: Error: Can't resolve '/lib/xp/context' in 'D:\Developement\enonic\test\src\main\resources'
resolve '/lib/xp/context' in 'D:\Developement\enonic\test\src\main\resources'
using description file: D:\Developement\enonic\test\package.json (relative path: ./src/main/resources)
Field 'browser' doesn't contain a valid alias configuration
root path D:\Developement\enonic\test\src\main\resources
using description file: D:\Developement\enonic\test\package.json (relative path: ./src/main/resources/lib/xp/context)
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context.ts doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context.json doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context.js doesn't exist
.es
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context.es doesn't exist
.es6
Field 'browser' doesn't contain a valid alias configuration
D:\Developement\enonic\test\src\main\resources\lib\xp\context.es6 doesn't exist
as directory
D:\Developement\enonic\test\src\main\resources\lib\xp\context doesn't exist
No description file found in /lib/xp or above
no extension
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context.ts doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context.json doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context.js doesn't exist
.es
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context.es doesn't exist
.es6
Field 'browser' doesn't contain a valid alias configuration
/lib/xp/context.es6 doesn't exist
as directory
/lib/xp/context doesn't exist
webpack 5.88.2 compiled with 1 error in 3880 ms
ERROR: "build:server" exited with 1.
Process finished with exit code 1
What did I make wrong ?