TypeScriptを勉強しようと環境を作成しています。
TypeScript+Gulp+Webpack+jQueryで開発環境を構築
こちらのサイトをもとに試行錯誤上コンパイルできる環境を作成しようとしています。
どうにか作成した環境をコンパイルするとエラーが出て困っています。
どうしてこのようなエラーが出るのかご教授をお願いします。
勉強中なので、あまり開発環境の構築の方法を理解していません。
よろしくお願いします。
【開発環境】
gulp: 4.0.2
typescript: 4.0.5
webpack: 5.4.0
jquery: 3.5.1
gulp-stream: 0.0.2
//エラー内容
Starting 'default'... [02:35:19] 'default' errored after 5.18 s [02:35:19] Error in plugin "webpack-stream" Message: [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] [object Object] Details: domainThrown: true
// typescriptをコンパイルする構成図
dist └── main.js node_modules └── typescriptなど ts ├── index.ts gulpfile.js index.html package.json tsconfig.json webpack.config.js
// index.ts
'use strict'; import $ = require('jquery'); function ShowJQueryConfirmDialog() { var strTitle = "確認ダイアログ"; var strComment = "これは確認ダイアログです。"; function ShowConfirmDialog() { if (confirm("これは確認ダイアログです。")) { alert("OKボタンがクリックされました"); } else { alert("キャンセルボタンがクリックされました"); } } function hello(name: string): void { console.log("Hello " + name + "!"); } let your_name: string = "Yamada"; hello(your_name);
// gulpfile.js
const gulp = require("gulp"); const webpackStream = require("webpack-stream"); const webpack = require("webpack"); const del = require("del") const webpackConfig = require("./webpack.config"); gulp.task("clean", () => { return del("./js/dist/*", {force: true}); }); gulp.task("default", () => { return webpackStream(webpackConfig, webpack) .pipe(gulp.dest("./js/dist")); });
// webpack.config.js
'use strict'; module.exports = { mode: 'development', devtool: 'source-map', entry: { app :'./ts/index.ts' }, output: { path: `${__dirname}/js/`, filename: 'main.js' }, module: { rules: [ { test: /.ts$/, exclude: /node_modules/, use: { loader: 'ts-loader' } } ] }, resolve: { extensions: ['.ts'] } };
あなたの回答
tips
プレビュー