Quickstart project for knockout.js + TypeScript + decorators with Webpack2.
npm install knockout-webpack-ts-quickstartsrc/app/AppModule.ts and src/app/components/*Component.ts.
package.json.
webpack.config.js.
javascript
// [Node-single-js-file]: Packing a Node single Javascript file.
{
entry: {
// TODO: YOU SHOULD REPLACE THE LIBRARY OUTPUT NAME!
: path.resolve(__dirname, 'src/index.ts')
},
output: {
// TODO: YOU SHOULD REPLACE THE LIBRARY NAME!
library: '',
...
},
module: {
rules: {
test: /\.tsx?$/,
...
// TODO: YOU SHOULD REPLACE THE PACKAGE NAME!
// exclude 'node_module' directory except myself (refered from other packages)
exclude: /node_modules[\/\\.*$/
}, {
test: /\.jsx?$/,
...
// TODO: YOU SHOULD REPLACE THE PACKAGE NAME!
// exclude 'node_module' directory except myself (refered from other packages)
exclude: /node_modules\/\\.*$/
}, {
...
},
// [Browser-single-js-file]: Packing a library Javascript file.
{
entry: {
// TODO: YOU SHOULD REPLACE THE LIBRARY OUTPUT NAME!
: path.resolve(__dirname, 'src/index.ts')
},
output: {
// TODO: YOU SHOULD REPLACE THE LIBRARY NAME!
library: '',
...
},
module: {
rules: {
test: /\.tsx?$/,
...
// TODO: YOU SHOULD REPLACE THE PACKAGE NAME!
// exclude 'node_module' directory except myself (refered from other packages)
exclude: /node_modules[\/\\.*$/
}, {
test: /\.jsx?$/,
...
// TODO: YOU SHOULD REPLACE THE PACKAGE NAME!
// exclude 'node_module' directory except myself (refered from other packages)
exclude: /node_modules\/\\.*$/
}, {
...
},
`
1. Write your code.
1. and build it.
`sh
npm run build
npm test
`
Compile SCSS Stylesheets to single CSS file.
1. Clone me:
`sh
git clone shellyln/knockout-webpack-ts-quickstart.git
`
1. Build me:
`sh
npm run build
npm test
`
1. Copy dist/style.min.css and dist/style.min.css.map to your site.
1. and use:
app.html
`html
`
Debugging with Webpack
1. npm start`