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

This package does not with Create React App #286

Closed
DrRataplan opened this issue Feb 4, 2021 · 4 comments
Closed

This package does not with Create React App #286

DrRataplan opened this issue Feb 4, 2021 · 4 comments

Comments

@DrRataplan
Copy link
Collaborator

Since the dependency on xspattern, this package is incompatible with Create React App. Reason for this is that xspattern publishes an xspattern.mjs file, on which Closure Compiler errors.

There is a workaround by using create-react-app-rewired.

To get this workaround to work, follow the following steps:

  1. Install create-react-app-rewired
  2. Create a config-overrides-file.js in the root of your repository with the following:
const { override } = require("customize-cra");

const supportMjs = () => (webpackConfig) => {
    webpackConfig.module.rules.push({
        test: /\.mjs$/,
        include: /node_modules/,
        type: "javascript/auto",
    });
    return webpackConfig;
};

module.exports = override(
    supportMjs()
);
  1. Change the start/stop/eject scripts to use the create-react-app-rewired variants:
"scripts": {
-    "start": "react-scripts start",
-    "build": "react-scripts build",
-    "test": "react-scripts test",
+    "start": "react-app-rewired start",
+    "build": "react-app-rewired build",
+    "test": "react-app-rewired test",
     "eject": "react-scripts eject"
   },

There is already an issue on xspattern.js: bwrrp/xspattern.js#18.

There is also an issue on create-react-app: facebook/create-react-app#10356.

I will update this issue when anything changes.

@bwrrp
Copy link
Member

bwrrp commented Feb 7, 2021

I've just released xspattern 2.0.0 which renames the bundles to both use the .js extension. This release has no other changes. Could you try bumping the dependency version and confirm whether that resolves the problem with CRA?

@DrRataplan
Copy link
Collaborator Author

Just released 3.15.0 @EvadeHaas @wvbe could you check whether CRA eats FontoXPath and xspattern now?

@EvadeHaas
Copy link
Member

I can confirm that this works for a tsdx app

@DrRataplan
Copy link
Collaborator Author

Yay! Thanks for the confirmation @EvadeHaas! I'm closing this issue!

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

No branches or pull requests

3 participants