question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[react-form] Not working with Shopify embedded app

See original GitHub issue

Overview

When trying to use @shopify/react-form I get the following error: ./node_modules/@shopify/react-form/build/esm/validation/validator.mjs Can't import the named export 'isEmpty' from non EcmaScript module (only default export is available)

The error is caused even by just importing the library: import { useField, useForm } from '@shopify/react-form';

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
patryk-smccommented, Jan 9, 2021

Similar issue with @shopify/react-i18n

It seems to be related to Next.js

error - ./node_modules/@shopify/react-i18n/build/esm/i18n.mjs
Can't import the named export 'TimeUnit' from non EcmaScript module (only default export is available)
5reactions
denisgoryaynovcommented, Jan 8, 2021

@dahukish I created my project using the Shopify cli: shopify create node and running my project with shopify serve. I actually managed to workaround the issue but it required updating my next.config.js like this:

const { parsed: localEnv } = require("dotenv").config();
const withCSS = require("@zeit/next-css");

const webpack = require("webpack");
const apiKey = JSON.stringify(process.env.SHOPIFY_API_KEY);

module.exports = withCSS({
  webpack: config => {
    const env = { API_KEY: apiKey };
    config.plugins.push(new webpack.DefinePlugin(env));
    /* add this */
    config.module.rules.push({
	test: /\.mjs$/,
	include: /node_modules/,
	type: "javascript/auto",
    });
    /*  */
    return config;
  }
});

Maybe it should be documented somewhere or added to the template generated by shopify-cli?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AppBridge not working in Embedded App - Shopify Community
App is setup as embedded The rest of the app loads and works fine... I can create the TitleBar, but it's not showing....
Read more >
Polaris App Bridge React Model Question - Shopify Community
Showing off App Bridge code is no use as that Modal does not work properly in the embedded App sense, and fails to...
Read more >
Error while building Shopify Sample Embedded App
Solved: Hi, I've been following the tutorial, https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react, and I got stuck with some errors.
Read more >
Polaris App Bridge React Model Question - Shopify Community
The Modal in App Bridge React does not work like the other one. It has no Modal.section. So that whole working pattern is...
Read more >
Integrating Custom App with Custom Storefront using latest stack
Hi @domparise,. The embedded app SDK (EASDK) is only applicable to building applications for the Shopify Admin and in general it is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found