diff --git a/.gitignore b/.gitignore index d65bca9..47e4920 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules npm-debug.log test/tests.bundle.js .DS_Store -.idea \ No newline at end of file +.idea +dist/ \ No newline at end of file diff --git a/example/example1/src/main.tsx b/example/example1/src/main.tsx index a7ecc97..6f5409d 100644 --- a/example/example1/src/main.tsx +++ b/example/example1/src/main.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { render } from "react-dom"; -import { Stage, Box, Text, Image } from "react-laya"; +const { Stage, Box, Text, Image } = require("../../../dist/bundle"); console.log(process.env.NODE_ENV); class App extends React.Component { @@ -42,7 +42,7 @@ class App extends React.Component { render() { let state = this.state; return ( - console.log(node)} onRightClick={this.handleClick}> + { height={184} /> console.log(node)} x={200} y={200} anchorX={0.5} diff --git a/package.json b/package.json index a39e998..7b7cebc 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "license": "MIT", "licenses": "MIT", "main": "src/index.js", + "scripts": { + "build": "webpack" + }, "repository": { "type": "git", "url": "git@github.com:zsytssk/react-laya.git" diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..aeabee3 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,18 @@ +"use strict"; +const path = require("path"); +const webpack = require("webpack"); + +module.exports = { + entry: "./src/index.js", + target: "node", + output: { + path: __dirname + "\\dist", + filename: "bundle.js", + library: "index", + libraryTarget: "umd" + }, + mode: "development", + resolve: { + extensions: [".ts", ".tsx", ".js"] + } +};