Question: I have a two parter question I’ve broken down regarding babel compilation error codes. Let’s say I decide I want to not ignore node_modules so that I can take advantage of expose-loader and expose jquery for example. files in node_modules which are already precompiled and doing export/import stuff throws the error Can I resolve these module.exports errors with a webpack plugin that resolves to commonJS? https://github.com/Kielan/testWebpackErr What should I assume the problem is, the files referenced are mostly index.js files with module.exports and I suppose this is called commonJS module system.
 
at transpile (/path/node_modules/babel-loader/lib/index.js:79:20)
Module build failed: TypeError: Cannot read property 'code' of null The first is, if I don’t ignore node_modules inside my loaders, such as files in node_modules/css loader, style-loader, react-dom cause the error

Asked By
kielan
Asked At
2017-12-15 08:25:01

Found 15 possible answers.

User Answered At Possible Answer
peri.nikhil10 2017-12-15 09:09:33 Hi Guys, I’d like to know how exactly the syntax plugins work…any docs i can refer?
satya164 2017-12-15 09:10:56 you can’t write custom syntax plugins
kielan 2017-12-15 09:22:51 does babel 7 have an internal form of this feature https://github.com/59naga/babel-plugin-add-module-exports
peri.nikhil10 2017-12-15 10:01:06 all right, so the ones that are defined by Babel, where are they defined? [December 15th, 2017 2:40 PM] satya164: you can’t write custom syntax plugins I mean, i didnt find the babel-plugin-syntax-* to be helpful of how they do what they do…
kielan 2017-12-15 10:15:39 https://github.com/Kielan/testWebpackErr take a look at latest. I’ve tried to make it very clear. I am using @babel /preset-stage-2 which should include namespace plugin, needed to handle node modules with commonjs export
satya164 2017-12-15 10:17:03 they just enable a syntax supported by babylon
kielan 2017-12-15 10:59:01 this is a complex little package
https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime 
peri.nikhil10 2017-12-15 11:27:14 aah….okay cool thanks a ton :smile: :confetti_ball:
kielan 2017-12-15 11:39:26
https://github.com/babel/babel/issues/7031 
it’s unclear whether to resolve this problem I need
@babel/transform-runtime
plugin or if I need to add some options to my babel-loader, or if this is a bug. Sorry to spam the chat.
palaniychuk 2017-12-15 12:40:14 Hello, I have an issue with new babel 7 and nyc(istanbul) looks like it not covers arrow function. or something wrong with configuration for test env or babel-istanbul-plugin https://github.com/istanbuljs/nyc/issues/750
john984 2017-12-15 12:48:47 Hello, can someone show me the syntax for using useBuiltIns in my config, please. }))
    presets: [['babel-preset-env', {useBuiltIns: true}]]
.transform(babelify.configure({ Sorry, ignore me, it is this :joy: }))
    useBuiltIns: true
    presets: ['babel-preset-env'],
.transform(babelify.configure({ What i currently have below is not running gulp
kielan 2017-12-15 13:18:52 @jp what does the useBuiltIns option do?
john984 2017-12-15 17:27:26 @kielan - it was suggested on here that it uses built in polyfills to fix issues depending on the environment that the code runs in you can read a bit more here: http://babeljs.io/docs/plugins/preset-env/#optionsuse-built-ins
kielan 2017-12-16 07:17:48 the new babel react logging with decorators wis quite nice let’s get an omg hip hip hurray transform runtime enables generators on latest
unclear whether I need to use both <@babel>/runtime or must use both. “is to be used” is kinda unclear where the delineation of use cases are based on config
@babel/runtime is similar to the polyfill except that it doesn't modify the global scope and is to be used with @babel /plugin-transform-runtime (usually in library/plugin code). Check out the docs. could conceivably come up with new coding patters and even languages. I thought it was overly complex at first but now I understand how powerful this is. some of the small modules are still pretty tough to totally grok still much more to learn trying out @babel /polyfill we’ll see how this goes, decorators working great. useBuiltins didn’t seem to fix the generators set up I currently have. I am on latest so I understand it’s in active dev. I’ve learned so much about babel in the past week :joy:
nicolo-ribaudo 2017-12-16 15:23:40 It should be "either one or the other"

Related Questions