Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as React from "react";
- import * as ES5Promise from "promise";
- export class MyComponent extends React.Component<{}, {}> {
- constructor(props) {
- super(props);
- }
- private readonly onLoadModuleClickHandler = (): void => {
- import("./Button").then((module) => {
- console.log(module);
- });
- }
- render() {
- return (
- <div>
- <input type="button" value="Load another module" onClick={this.onLoadModuleClickHandler}/>
- </div>
- );
- }
- }
- {
- "compilerOptions": {
- "moduleResolution": "node",
- "noImplicitAny": false,
- "noEmitOnError": true,
- "module": "esnext",
- "removeComments": false,
- "sourceMap": false,
- "target": "es5",
- "jsx": "react",
- "noEmit": true,
- "importHelpers": true,
- "lib": ["dom", "es5", "es2015.promise"]
- },
- "exclude": [
- "node_modules",
- "wwwroot"
- ]
- }
- module.exports = {
- entry: {
- "app": "./src/App.tsx"
- },
- output: {
- path: path.resolve(__dirname, 'wwwroot/dist'),
- filename: "[name].bundle.js",
- chunkFilename: "[name].chunk.js"
- },
- module: {
- rules: [
- {
- test: /.(ts|tsx)?$/,
- use: "awesome-typescript-loader",
- exclude: /node_modules/
- },
- {
- test: /.(css|less)?$/,
- use: [{
- loader: "style-loader"
- }, {
- loader: "css-loader?modules&localIdentName=[local]--[hash:base64:5]"
- }, {
- loader: "less-loader"
- }]
- },
- ]
- },
- resolve: {
- extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".less"]
- }
- };
Add Comment
Please, Sign In to add comment