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

Workspace package works during build, but not development #964

Closed
philipnilsson opened this issue Apr 2, 2019 · 3 comments
Closed

Workspace package works during build, but not development #964

philipnilsson opened this issue Apr 2, 2019 · 3 comments
Labels

Comments

@philipnilsson
Copy link

philipnilsson commented Apr 2, 2019

I'm using yarn workspaces which links workspace packages under node_modules without running babel on the package. For this reason I'd like to ensure that my razzle setup runs babel on these packages.

Most likely my problem can be simplified to "run babel also for imports under node_modules/@myorg", potentially with the complication that these packages are symlinks.

I've tried changing my configuration by adding a razzle.config.js webpack override, which runs during packaging

const path = require('path');

module.exports = {
  modify: (config, { target, dev }, webpack) => {
    // rules[2] is the babel loader.
    config.module.rules[2].include.push(
      path.join(__dirname, './node_modules/@myorg')
    );
    return config;
  },
}

Everything seems to be going fine when I run the build script. My code comes out transpiled correctly. However, when I'm running the start scripts, I keep getting an error preventing the server from starting.

image

Any advice?

@vitorcamachoo
Copy link

I'm using yarn workspaces which links workspace packages under node_modules without running babel on the package. For this reason I'd like to ensure that my razzle setup runs babel on these packages.

Most likely my problem can be simplified to "run babel also for imports under node_modules/@myorg", potentially with the complication that these packages are symlinks.

I've tried changing my configuration by adding a razzle.config.js webpack override, which runs during packaging

const path = require('path');

module.exports = {
  modify: (config, { target, dev }, webpack) => {
    // rules[2] is the babel loader.
    config.module.rules[2].include.push(
      path.join(__dirname, './node_modules/@myorg')
    );
    return config;
  },
}

Everything seems to be going fine when I run the build script. My code comes out transpiled correctly. However, when I'm running the start scripts, I keep getting an error preventing the server from starting.

image

Any advice?

You Forgot to add whitelist in node-externals.

@stale stale bot added the stale label Jun 10, 2019
@philipnilsson
Copy link
Author

Thanks for the advice. A variation of this worked to resolve this.

@simonmares
Copy link

simonmares commented Nov 25, 2019

A variation of this worked to resolve this.

@philipnilsson can you share the razzle.config.js file? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants