Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keystone Build fails silently with Admin Hook with bad import #135

Open
Echooff3 opened this issue Feb 18, 2021 · 0 comments
Open

Keystone Build fails silently with Admin Hook with bad import #135

Echooff3 opened this issue Feb 18, 2021 · 0 comments

Comments

@Echooff3
Copy link

Bug report

Describe the bug

If you use the admin hooks pages option described here and you attempt to import a module that does not exist inside the hook, the build process will fail silently.

To Reproduce

Steps to reproduce the behaviour.

  1. Create a new blank Keystone project as described in Getting Started
  2. Add the cookieSecret to the config so you can build.
  3. In a separate file create your Pages Admin Hook
  4. Apply that hook to the Admin UI Config
  5. Run yarn build
  6. Build process will say it exported to ./dist
  7. ./dist folder does not exist
// index.js
const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');
const { KnexAdapter: Adapter } = require('@keystonejs/adapter-knex');
const PROJECT_NAME = 'a test';
const adapterConfig = { knexOptions: { connection: 'postgres://localhost/somedb' } };

const keystone = new Keystone({
  adapter: new Adapter(adapterConfig),
  cookieSecret: 'a4d836361ce60d2770bec8de5644920aa4d836361ce60d2770bec8de5644920aa4d836361ce60d2770bec8de5644920a'
});

module.exports = {
  keystone,
  apps: [
    new GraphQLApp(), 
    new AdminUIApp({ 
      name: PROJECT_NAME, 
      enableDefaultRoute: true,
      hooks: require.resolve('./hooks') // <- hooks.js in next code snippet
    })],
};
// hooks.js
import NotARealComp from 'itdoesntmatter' // <- Replace this with anything

export default {
    pages: () => [
        // Custom pages
        {
            label: 'Custom Page',
            path: 'custom-page',
            component: NotARealComp,
        },
    ]
}

Expected behaviour

At minimum the build tool should report an error that the build failed.

System information

OS: Mac or Linux

NPM: 7.5.1

Node: v15.8.0

Yarn: 1.22.10

Additional Info

Possibly related to keystonejs/keystone#4339

@timleslie timleslie transferred this issue from keystonejs/keystone May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants