When I try to export my schema and data after installing the config files, I get:
(node:53394) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
[17:45:56.016] INFO: Loaded extensions: directus-extension-schema-sync
[17:45:56.020] INFO: Exporting everything to: /Users/marty/.sources/github.com/martin-braun/gf-server/schema-sync/data
[17:45:56.030] ERROR: Unexpected token 'export'
err: {
"type": "SyntaxError",
"message": "Unexpected token 'export'",
"stack":
/Users/marty/.sources/github.com/martin-braun/gf-server/schema-sync/directus_config.js:12
export const syncDirectusCollections = {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
Fixed by putting "type": "module", into the package.json, could you please update the documentation. Directus does not initialize with this line in the package.json.
Describe the Bug
When I try to export my schema and data after installing the config files, I get:
My package.json, that was generated, is:
I haven't modified the schema-sync files yet, but looking at those I can see how it should already work for users, roles, etc.
To Reproduce
nvm use 18
npm init directus-project my-directus && cd my-directus
to create a new projectnpm install directus-extension-schema-sync
npx directus schema-sync install
npx directus schema-sync export
Version
1.6.4
Installed Extension Via
NPM Custom