-
webpack 삽질기공부/언젠가 필요할지도... 2019. 7. 25. 15:56
webpack을 사용해 보기
html-webpack-plugin을 플러그인에 추가하니 아래와 같은 에러가 계속 발생하고 있다.
12345678910111213141516171819202122232425262728293031323334353637383940414243ERROR in Error: C:\workspace\temp\babel\node_modules\html-webpack-plugin\default_index.ejs:207var TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag'); // ES3 wrong here^TypeError: __webpack_require__(...) is not a function- default_index.ejs:207 Object../node_modules/core-js/modules/_classof.js[babel]/[html-webpack-plugin]/default_index.ejs:207:86- default_index.ejs:21 __webpack_require__[babel]/[html-webpack-plugin]/default_index.ejs:21:30- default_index.ejs:2287 Object../node_modules/core-js/modules/es6.object.to-string.js[babel]/[html-webpack-plugin]/default_index.ejs:2287:15- default_index.ejs:21 __webpack_require__[babel]/[html-webpack-plugin]/default_index.ejs:21:30- default_index.ejs:2783 Module../node_modules/core-js/modules/es6.regexp.to-string.js[babel]/[html-webpack-plugin]/default_index.ejs:2783:94- default_index.ejs:21 __webpack_require__[babel]/[html-webpack-plugin]/default_index.ejs:21:30- default_index.ejs:241 Module.<anonymous>[babel]/[html-webpack-plugin]/default_index.ejs:241:140- default_index.ejs:251 Module../node_modules/core-js/modules/_cof.js[babel]/[html-webpack-plugin]/default_index.ejs:251:30- default_index.ejs:21 __webpack_require__[babel]/[html-webpack-plugin]/default_index.ejs:21:30- default_index.ejs:867 Object../node_modules/core-js/modules/_is-regexp.js[babel]/[html-webpack-plugin]/default_index.ejs:867:11Child html-webpack-plugin for "index.html":1 assetEntrypoint undefined = index.html[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 968 bytes {0} [built][./node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 631 bytes {0} [built][./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {0} [built]+ 86 hidden modulescs 원인은 module -> rules에 exclude에 /node_modules/를 넣지 않았기 때문이었다.
아래와 같이 추가하니 에러는 발생하지 않았다.
123456789101112131415161718192021222324const path = require('path');const HtmlWebpackPlugin = require('html-webpack-plugin');module.exports = {entry: './src/test.js',output: {path: path.resolve(__dirname, 'dist'),filename: 'bundle.js'},module: {rules: [{test: /\.js$/,exclude: /node_modules/,use: 'babel-loader'}]},plugins: [new HtmlWebpackPlugin()],mode: 'development',devtool: 'inline-source-map'}cs '공부 > 언젠가 필요할지도...' 카테고리의 다른 글
jsfiddle에서 npm 라이브러리 참조하기 (0) 2019.07.26 Prosemirror 개발 환경 설정 (0) 2019.07.26 아이콘 만들기 (0) 2019.07.25 소스코드 등록하기 (0) 2018.12.19