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

Use webpack alias for vendor modules that may already be on page #11

Open
nealfennimore opened this issue Mar 23, 2018 · 0 comments
Open
Assignees

Comments

@nealfennimore
Copy link
Contributor

nealfennimore commented Mar 23, 2018

https://github.com/moderntribe/rest-api-tester/blob/master/src/resources/js/src/components/Methods.js#L1

I see this pattern a lot in the app. Would the preferred react version it uses be on the admin panel?

We can use a resolve alias in webpack to cut down on this. An intermediary could then be used that always just returns the correct react:

const React = window.React || require('react');
module.exports = React

In webpack add something like:

alias: {
  react$: path.resolve(__dirname, 'src/resources/js/src/react.js')
}
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