Sign inSign up

punimeister/webpack-typescript

By punimeister

Updated about 7 years ago

Image
0

278

punimeister/webpack-typescript repository overview

Environment Variables

MODE

Will be used for webpack mode

EP_*

Will be used for webpack entry points
(See example for details)

OUTPUT_DIR

Will be used for webpack output directory

OUTPUT_FILE

Will be used for webpack output filename

Example

Directory structure
.
├── .gitignore
├── docker-compose.yml
└── web
    ├── public
    │   └── index.html
    └── src
        ├── entry.ts
        ├── module.ts
        └── sub.ts
.gitignore
node_modules
*.js.map
docker-compose.yml
version: '3'

services:

  webpack-typescript:
    image: punimeister/webpack-typescript
    restart: on-failure
    environment:
      MODE: development
      EP_main: ./web/src/entry.ts
      EP_sub: ./web/src/sub.ts
      OUTPUT_DIR: ./web/public
      OUTPUT_FILE: '[name].js'
    volumes:
      - .:/app
index.html
<!doctype html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title>webpack typescript testing</title>
</head>
<body>
  <script src="main.js"></script>
  <script src="sub.js"></script>
</body>
</html>
entry.ts
import greeting from './module';

const message: string = 'hello webpack';
greeting(message);
module.ts
export default function greeting(msg: string) {
  alert(msg);
}
sub.ts
import greeting from './module';

const message: string = 'nice to meet you';
greeting(message);

Tag summary

Content type

Image

Digest

Size

24.8 MB

Last updated

about 7 years ago

docker pull punimeister/webpack-typescript