-
Notifications
You must be signed in to change notification settings - Fork 420
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
Webpack build failing with "Cannot read property 'bindings' of null" #1621
Comments
Thanks for opening your first issue! 👋 |
Since you are new, I will ask, did you If that doesn't work, I do know plenty of folks that do use the named import version without issue. The primary reason that I recommend the source code version is that there are so many different ways to build things, and so many engineers that want to micro-optimize things their own way, and I don't want to debug folks webpack configs. 😉 I can just say, uh here's the source, go to town with your own build. |
The repo itself is using the babel plugin for storybook, so you might look there. I'm going to close this issue, since the named import version shouldn't require babel presets. Feel free to re-open with new information and to hopefully post what the issue was so other can learn. 🎉 |
Hey @interactivellama thanks for the response. I've ended up just importing the main SLDS CSS and a static resource, rather than getting it into webpack, and am now using the named import version instead of the source code. It's working, so... I'm good with it. Thanks. |
Adding the babel preset to a fresh create react app breaks serviceWorker.js |
I guessing we have old Babel presets. The preset config is located at But eventually will be moved to https://github.com/salesforce/babel-preset-design-system-react |
@interactivellama I'm trying to use the master branch in my project in order to add some features to the input elements (I find the way the components are written to be easier to work with). I get the error:
Do I have any hope of using the master branch ? |
That's the first line that has a default export in the library, which means https://babeljs.io/docs/en/babel-plugin-proposal-export-default-from is probably not working. There are three versions of the preset. You might try 3.0. Currently this library is installing 1.0
|
Hi, We've been running into the same issues as above while trying to use the preset:
Like you mentioned @interactivellama, the preset seems to be a wrapper for outdated Babel presets. Why not simply ask users to use the presets in their own |
Hi, an update for those looking to build them in webpack and not use named imports We were able to build using these presets, which are simply the updated babel7+ valid versions of the packages that the salesforce wrapper tries to import here https://github.com/salesforce/design-system-react/blob/master/preset/index.js In your webpack config, add these options for babel-loader:
and you should be good! @interactivellama maybe this should be added to the main README instead of importing the now outdated preset? |
@CrazyByDefault Link to your issue comment added in readme. Thank you! https://github.com/salesforce/design-system-react/blob/master/README.md#transpile-with-babelrc-settings |
As the source code of preset at https://github.com/salesforce/design-system-react/blob/master/preset/index.js evolved Here is an update for @CrazyByDefault 's sample solution. I hope it helps people like me diving into this library. In your webpack config, add these rules/options for babel-loader: module: {
rules: [
{
test: /\.jsx?$/,
include: [
'node_modules/@salesforce/design-system-react',
].map(
someDir => path.resolve(
process.cwd(),
someDir
)
),
loader: require.resolve('babel-loader'),
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
]
}
},
]
} |
Does anyone know the equivalent changes that might need to be made to get this to work with Parcel instead of webpack? I am experiencing these same issues and have tried updating my babelrc to no avail and still getting this error on every compile:
|
for anyone else struggling this even after reading the full series of comments above, here is my working config
|
I'm seeing some unusual behavior when add the design-system-react to my build. When it is not present, this builds successfully as expected:
src/index.js
When I add
path.join(__dirname, 'node_modules/@salesforce/design-system-react')
to my webpack config and"@salesforce/babel-preset-design-system-react"
to my babelrc file, the build fails with the error in the subject.Oddly, if I remove the import of the Test component and use
ReactDOM.render(<p>Hi from index</p>, document.getElementById('app'));
in my index file, the compile is successful.Here are the relevant files:
webpack.config.js
.babelrc
src/Test.js
I'm fairly new to babel and webpack so hope it's not something obvious I'm missing.
I've looked through the existing open and closed issues, but can't find anything similar. Hoping someone can help as I'd really like to use this library with a current project.
Thanks.
The text was updated successfully, but these errors were encountered: