ES6 Tutorial - #10 Modules (import & export)

preview_player
Показать описание
0:14 WebpackBin setup
0:43 CommonJS, AMD, UMD
2:24 import/export syntax support
3:31 Multiple named exports
5:09 Multiple named imports
7:10 Inline export
8:22 Export with an alias
10:20 Import with an alias
11:52 Default exports & imports
12:45 Default imports can be bound to any symbol
13:12 Inline default export
13:25 Don't mix export default with const
14:58 Default-exporting an anonymous func
15:42 Mixed exports & imports
18:07 Importing for side effects only
18:49 Exporting imported modules

Рекомендации по теме
Комментарии
Автор

I am glad that you've captured webpackbin playground in action (it's not available right now)

artihlec
Автор

You Explained very nicely as well very clearly. I really thank you for this type of video tutorial for us. Can you create Form Validation as well error display in HTML itself? We want to know how to populate error message in dynamically when user clicks SUBMIT Button.

Thanks Advance

AntonyAllocious
Автор

what is the difference between "export default class BasePage" and export default new BasePage()

nekkantisandeepkumar
Автор

I read somewhere that you could use these natively in chrome.

I have an express server running which is working and serving a ejs file. That file has a script tag that says <script src="import.js" type="module" > , then I have an import file that says import {keyValue} from 'export'
, and an export file that says export let keyValue=1000; ...its not working when I try to console.log(keyValue) from import . very frustrating, any advice ??

johnn
Автор

Luxon Es6 import not working pls help


import { DateTime } from 'luxon';

SyntaxError: The requested module 'luxon' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'luxon';
const { DateTime } = pkg;

hayathbasha
Автор

after build, I get error: "SyntaxError: Unexpected token export". It doesn't seem to like "export" in the external module. In package.json scripts I am using `babel app_es6.js --out-file app.js`.

oshihirii
Автор

Putting in webpackbin.com seems to just take me to these random site redirects, offering links or a fishy Chrome security extension.

ctber