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.

babelInclude on a symlink folder does not work

See original GitHub issue

i have an external component folder linked to my web project through npm-link. on my web project i have configured config-override to babel parse the npm-linked folder withe the proper plugin.

this works well when not using npm link and simply downloading from npm when using npm-link i get errors related to not using “babel/plugin-proposal-class-properties”

tried also replacing:

path.resolve(‘node_modules/@blio’),

with

fs.realpathSync(‘node_modules/@blio’)

and it didn’t help either

i am using: “react-scripts”: “3.0.0”, “customize-cra”: “^0.2.14”,

const { override, fixBabelImports, addBabelPlugin, babelInclude, addLessLoader } = require('customize-cra');
const path                                                                       = require('path');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: { '@primary-color': '#047fff' },
  }),
  addBabelPlugin('@babel/plugin-proposal-class-properties'),
  babelInclude([
    path.resolve('src'), // don't forget this
    path.resolve('node_modules/@blio'),
  ]),
);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
switzcommented, Aug 7, 2019

Thanks Mark, I’ve found a workaround: using fs.realPathSync instead of Path.resolve

Life saver! Only one note for future visitors, it’s fs.realpathSync (see casing).

Thanks so much @royair

1reaction
royaircommented, Jul 2, 2019

Thanks Mark, I’ve found a workaround: using fs.realPathSync instead of Path.resolve

Read more comments on GitHub >

github_iconTop Results From Across the Web

The create-react-app imports restriction outside of src directory
Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's...
Read more >
webpack/webpack - Gitter
I'm trying to run some es6/react tests with karma, however my webpack.config.js is using { test: /\.jsx?$/, loaders: ['babel'], include: ...
Read more >
[Solved]-Babel loader crashing npm build-babel.js
And then add a .babelrc file to your directory and fill it with the ... Babel install does not work through npm ·...
Read more >
Sharing source code and libraries in React - Medium
Create a simple shared component in the shared-lib src folder. Run ... For some reason symlinks don't work as expected, but fortunately Mike ......
Read more >
teambit - Bountysource
The problem is that if a file is added, there is no process that symlinks it to ... component to some other project...
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