content/snippets/js/s/module-cheatsheet.md
export const key = 'this-is-a-secret';
import { key } from 'environment';
{}.const environment = {
key: 'this-is-a-secret',
port: 8000
};
export default environment;
import environment from 'environment';
const { key, port } = environment;
default keyword.{}.export const envType = 'DEV';
const environment = {
key: 'this-is-a-secret',
port: 8000
};
export default environment;
import { envType }, environment from 'environment';
const { key, port } = environment;
const key = 'this-is-a-secret';
const port = 8000;
export {
key,
port
};
import { key, port } from 'environment';
const key = 'this-is-a-secret';
export { key as authKey };
import { authKey } from 'environment';
as keyword to rename an export.export const key = 'this-is-a-secret';
import { key as authKey } from 'environment';
as keyword to rename an import.as keyword) should be the same as the export.export const envType = 'DEV';
const environment = {
key: 'this-is-a-secret',
port: 8000
};
export default environment;
import * as env from 'environment';
const { default: { key, port}, envType } = environment;
* to import everything a module exports.default key on the imported object.