daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as React from "react";
  2. import * as ES5Promise from "promise";
  3.  
  4. export class MyComponent extends React.Component<{}, {}> {
  5.     constructor(props) {
  6.         super(props);
  7.     }
  8.  
  9.     private readonly onLoadModuleClickHandler = (): void => {
  10.         import("./Button").then((module) => {
  11.             console.log(module);
  12.         });
  13.     }
  14.  
  15.     render() {
  16.         return (
  17.             <div>
  18.                 <input type="button" value="Load another module" onClick={this.onLoadModuleClickHandler}/>
  19.             </div>
  20.         );
  21.     }
  22. }
  23.    
  24. {
  25.   "compilerOptions": {
  26.     "moduleResolution": "node",
  27.     "noImplicitAny": false,
  28.     "noEmitOnError": true,
  29.     "module": "esnext",
  30.     "removeComments": false,
  31.     "sourceMap": false,
  32.     "target": "es5",
  33.     "jsx": "react",
  34.     "noEmit": true,
  35.     "importHelpers": true,
  36.     "lib": ["dom", "es5", "es2015.promise"]
  37.   },
  38.   "exclude": [
  39.     "node_modules",
  40.     "wwwroot"
  41.   ]
  42. }
  43.    
  44. module.exports = {
  45.     entry: {
  46.         "app": "./src/App.tsx"
  47.     },
  48.     output: {
  49.         path: path.resolve(__dirname, 'wwwroot/dist'),
  50.         filename: "[name].bundle.js",
  51.         chunkFilename: "[name].chunk.js"
  52.     },
  53.     module: {
  54.         rules: [
  55.             {
  56.                 test: /.(ts|tsx)?$/,
  57.                 use: "awesome-typescript-loader",
  58.                 exclude: /node_modules/
  59.             },
  60.             {
  61.                 test: /.(css|less)?$/,
  62.                 use: [{
  63.                     loader: "style-loader"
  64.                 }, {
  65.                     loader: "css-loader?modules&localIdentName=[local]--[hash:base64:5]"
  66.                 }, {
  67.                     loader: "less-loader"
  68.                 }]
  69.             },
  70.         ]
  71.     },
  72.     resolve: {
  73.         extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".less"]
  74.     }
  75. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top