Skip to content

Instantly share code, notes, and snippets.

@KerryRitter
Created December 13, 2016 02:32
Show Gist options
  • Save KerryRitter/4aed5f0029a0c0e21b31f329ea3b6912 to your computer and use it in GitHub Desktop.
Save KerryRitter/4aed5f0029a0c0e21b31f329ea3b6912 to your computer and use it in GitHub Desktop.
webpack typescript test
import { Person } from "./person";
import "test";
const person = new Person("Kerry", "Ritter");
alert(person.fullName);
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
System.register(["./person", "test"], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var person_1, person;
return {
setters: [
function (person_1_1) {
person_1 = person_1_1;
},
function (_1) {
}
],
execute: function () {
person = new person_1.Person("Kerry", "Ritter");
alert(person.fullName);
}
};
});
/***/ }
/******/ ]);
//# sourceMappingURL=bundle.js.map
export class Person {
public constructor(
public firstName: string,
public lastName: string
) {
}
public get fullName(): string {
return `${this.firstName} ${this.lastName}`;
}
}
[1, 2, 3, 4].forEach(element => {
alert(element);
});
module.exports = {
entry: "./app.ts",
output: {
filename: "bundle.js"
},
// Currently we need to add ".ts" to the resolve.extensions array.
resolve: {
extensions: ["", ".ts", ".tsx", ".js", ".jsx"]
},
// Source maps support ("inline-source-map" also works)
devtool: "source-map",
// Add the loader for .ts files.
module: {
loaders: [
{
test: /\.ts$/,
loader: "awesome-typescript-loader"
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment