Skip to content

Instantly share code, notes, and snippets.

@KatagiriSo
Last active May 17, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatagiriSo/88a4324cf3c332ee7f7fccc14c29a7d6 to your computer and use it in GitHub Desktop.
Save KatagiriSo/88a4324cf3c332ee7f7fccc14c29a7d6 to your computer and use it in GitHub Desktop.
typescript start script
{
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"module": "es2015"
}
}
module.exports = {
// or production
mode: 'development',
entry: {
main:'./src/main.ts',
menu:'./src/menu.ts'},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader'
},
{
test: /\.html$/,
loader: 'html-loader'
}
]
},
// for import
resolve: {
extensions: [
'.ts'
]
}
};
var data = require( "./package.json" );
console.log( data );
data["scripts"] = {
"build": "webpack",
"watch": "webpack -w"
};
var fs = require('fs');
fs.writeFile('package.json', JSON.stringify(data, null, ' '));
#!/bin/bash
if [ $# -ne 1 ]; then
echo "directry name.."
exit 1
fi
dir=$1
echo "create" $dir
mkdir $dir
echo "cd" $dir
cd $dir
pwd
echo "npm init -y"
npm init -y
echo "npm install webpack webpack-cli typescript ts-loader html-loader"
npm install webpack webpack-cli typescript ts-loader html-loader
echo "cp file.js"
cp ../file.js file.js
echo "node file.js"
node file.js
rm file.js
echo "cp tsconfig.json"
cp ../_tmp_tsconfig.json tsconfig.json
echo "cp webpack.config.js"
cp ../_tmp_webpack.config.js webpack.config.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment