babel: ReferenceError: ** is not undefined error when using import
I’m using babel + browserify + gulp.
# app.js
import DatePicker from './DatePicker'
# use DatePicker here
It runs smoothly in the browser, however when I’m debugging, open console of DevTools and type DatePicker
, got an undefined error
ReferenceError: "DatePicker is not defined"
my gulpfile.js is like:
var bundle = browserify('./app.js', {
debug: true,
cache: {},
packageCache: {},
insertGlobals: true,
extensions: ['.js', '.jsx']
}).transform(babelify, {stage: 0, loose: "all"});
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
@aldendaniels Nope. That doesn’t allow for live bindings.
foo.js
bar.js
Running:
should output:
But with your suggestion will just output:
Expected behaviour. Imports need to be rewritten in order to support live bindings. For example:
is turned into
So the
DatePicker
binding doesn’t actually exist.