Norman's Note 諾曼筆記

Norman's Note 諾曼筆記

Babel

re-export

import * as React from 'react';

export default React;
export * from 'react';

export { default } from 'react';

import React from './reExport';
export { default as anotherName1 } from './someResource1';
export { default as anotherName2 } from './someResource1';

import { anotherName1, anotherName2 } from './upperFolder';

檔案路徑用 @ 來替代 ./ 的方法,增加引入的一致性

  "plugins": [
    [
      "babel-plugin-module-resolver",
      {
        "alias": {
          "@": "./"
        }
      }
    ]
  ]