ソースを参照

Simplify sample, update npm deps to remove npm security errors

Alex Dima 6 年 前
コミット
c79ea537b5

+ 1 - 0
browser-esm-webpack-monaco-plugin/.gitignore

@@ -0,0 +1 @@
+dist/*.js

+ 12 - 0
browser-esm-webpack-monaco-plugin/dist/index.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+</head>
+<body>
+
+<script src="./main.bundle.js"></script>
+
+</body>
+</html>

+ 4 - 13
browser-esm-webpack-monaco-plugin/index.html

@@ -11,20 +11,11 @@
 To run this sample, you need to:
 
 <pre>
-$/browser-esm-webpack-monaco-plugin> npm install
-$/browser-esm-webpack-monaco-plugin> npm run start
-
-# or to build for production
-$/browser-esm-webpack-monaco-plugin> npm run build
+$/browser-esm-webpack> npm install .
+$/browser-esm-webpack> ./node_modules/.bin/webpack
 </pre>
 
-If you're building for production you need to statically serve the files:
-
-<pre>
-$/browser-esm-webpack-monaco-plugin> npm run build
-$/browser-esm-webpack-monaco-plugin> cd dist
-$/browser-esm-webpack-monaco-plugin/dist> npx static-server -p 3000 -o
-</pre>
+Then, <a href="./dist">open the ./dist folder</a>.
 
 </body>
-</html>
+</html>

+ 1 - 1
browser-esm-webpack-monaco-plugin/index.js

@@ -1,4 +1,4 @@
-import * as monaco from "monaco-editor";
+import * as monaco from "monaco-editor/esm/vs/editor/editor.api";
 
 (function () {
 	// create div to avoid needing a HtmlWebpackPlugin template

ファイルの差分が大きいため隠しています
+ 74 - 644
browser-esm-webpack-monaco-plugin/package-lock.json


+ 6 - 10
browser-esm-webpack-monaco-plugin/package.json

@@ -6,21 +6,17 @@
 	"private": true,
 	"scripts": {
 		"test": "echo \"Error: no test specified\" && exit 1",
-		"start": "webpack-dev-server --progress --mode development",
-		"build": "webpack --progress --mode production"
+		"build": "webpack --progress"
 	},
 	"keywords": [],
 	"author": "",
-	"license": "ISC",
 	"devDependencies": {
-		"css-loader": "^2.1.1",
-		"file-loader": "^3.0.1",
-		"html-webpack-plugin": "^3.2.0",
+		"css-loader": "^3.2.0",
+		"file-loader": "^4.2.0",
 		"monaco-editor-webpack-plugin": "^1.7.0",
-		"style-loader": "^0.23.1",
-		"webpack": "^4.32.0",
-		"webpack-cli": "^3.3.2",
-		"webpack-dev-server": "^3.4.1"
+		"style-loader": "^1.0.0",
+		"webpack": "^4.39.2",
+		"webpack-cli": "^3.3.6"
 	},
 	"dependencies": {
 		"monaco-editor": "^0.16.2"

+ 17 - 38
browser-esm-webpack-monaco-plugin/webpack.config.js

@@ -1,43 +1,22 @@
 const path = require("path");
 const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
-const HtmlWebpackPlugin = require("html-webpack-plugin");
 
 module.exports = {
-    mode: process.env.NODE_ENV,
-    entry: "./index.js",
-    output: {
-        path: path.resolve(__dirname, "dist"),
-        filename: "[name].bundle.js",
-    },
-    module: {
-        rules: [
-            {
-                test: /\.css$/,
-                use: [
-                    "style-loader",
-                    "css-loader",
-                ],
-            },
-            {
-                test: /\.(png|jpg|gif|svg|woff2?|ttf|eot|otf)$/,
-                use: [
-                    {
-                        loader: "file-loader",
-                    },
-                ],
-            },
-        ],
-    },
-    plugins: [
-        new MonacoWebpackPlugin({
-            languages: ["typescript", "javascript", "css"],
-        }),
-		new HtmlWebpackPlugin()
-    ],
-    devServer: {
-        port: 4000,
-		hot: process.env.NODE_ENV === 'development',
-		open: true
-    },
-    devtool: process.argv.includes("--use-sourcemaps") ? "inline-source-map" : false,
+	mode: process.env.NODE_ENV,
+	entry: "./index.js",
+	output: {
+		path: path.resolve(__dirname, "dist"),
+		filename: "[name].bundle.js",
+	},
+	module: {
+		rules: [{
+			test: /\.css$/,
+			use: ["style-loader", "css-loader",],
+		}],
+	},
+	plugins: [
+		new MonacoWebpackPlugin({
+			languages: ["typescript", "javascript", "css"],
+		})
+	]
 };

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません