1.4.1์์ Webpack์์ ๋ค์ ๋ฌธ์ ๋ฅผ ๋ณด๊ณ ์์ต๋๋ค. ๋ด ์ฝ๋์๋ 1.4.0 ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
WARNING in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
@ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js 10:19-40
WARNING in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
@ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js 10:19-44
ERROR in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js
Module not found: Error: Cannot resolve module 'tls' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
@ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js 15:10-24
ERROR in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js
Module not found: Error: Cannot resolve module 'fs' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/options/lib
@ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js 6:9-22
+1
๋๋ ์ง๊ธ ์ถ์ฒํ๋ค:
module: {
noParse: ['ws']
},
externals: ['ws']
๋ ๋์ ํด๊ฒฐ์ฑ ์ ์ฐพ์ ๋๊น์ง
๊ทธ ์ด์ ๋ npm์ ๊ฒ์๋ ํจํค์ง์ <=1.4.0์ ์๋ webpack.config.js
ํ์ผ์ด ํฌํจ๋์ด ์๊ธฐ ๋๋ฌธ์ผ ์ ์์ต๋๋ค. ๊ทธ๋์ ๋ ์ ๊ฑด ์ด๋์ ๋์จ๊ฑฐ์ผ? ๋ฆฌํฌ์งํ ๋ฆฌ์์ ๋ณผ ์ ์์ต๋๋ค.
Browserify ๋น๋๋ ์คํจํฉ๋๋ค. 1.4.0์ ๊ฐ์ ๋ก ์ฌ์ฉํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค.
์ค์๋ก ๊ทธ ํ์ผ์ ๊ฒ์ํ์ต๋๋ค. ๋๋ ๋ธ๋ผ์ฐ์ ํ์์ ๋ฒ์ด๋๋ ์คํ์ ํ๊ณ ์์๋ค.
1.4.3
์์.
์ฐธ๊ณ ์ฌํญ: files
์ package.json
files
๋ฅผ ๋ช
์์ ์ผ๋ก ์ค์ ํด์ผ ํฉ๋๋ค.
1.4.3์์ ์ฌ์ ํ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ฒจ๊ฐ:
module: {
noParse: ['ws']
},
externals: ['ws']
๊ทธ๋๋ ๋์์ด ๋ฉ๋๋ค.
์์ง ๊ณ ์ฅ๋ฌ์ต๋๋ค.
@Levino ๋๋ ๋น์ ์ด ๊ฑฐ๊ธฐ ์์์ ๊ฐ์ด browserify๊ฐ ws๋ฅผ ๋ฌด์/์ ์ธํ๋๋ก ํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
๊ทธ๋ฌ๋ ์ด ํด๊ฒฐ ๋ฐฉ๋ฒ๋ณด๋ค ๋ ๋์ ์๋ฃจ์ ์ ์ด๋ ฌํ ํ์ํฉ๋๋ค.
์ง๊ธ์ ํจํค์ง์์ "^1.3.7" ๋์ "~1.3.7" ๋ฒ์ ์ ์ฌ์ฉํฉ๋๋ค.
์ด๊ฒ์ ์๋ฒ์์ ์ด socket.io-client ์ค๋ ๋๋ก ์ฎ๊ฒผ์ต๋๋ค.
1.3.7์ ์คํ ์ค์ด์๊ณ npm์ ์ฌ์ฉํ์ฌ socket.io-client๋ฅผ 1.4.3์ผ๋ก ์ ๋ฐ์ดํธํ์ต๋๋ค.
์ฑ์ socket.io-client๋ง์ ์ฌ์ฉํ์ฌ ๊ฒ์ ์๋ฒ์ ์ฐ๊ฒฐํฉ๋๋ค(socket.io 1.4.3์ผ๋ก๋ ์ ๋ฐ์ดํธ๋จ). Windows 7์์ ๊ฐ๋ฐ ์ค์ ๋๋ค.
npm์ ํตํด ์ ๊ฑฐ ๋ฐ ๋ค์ ์ค์น๋ฅผ ์๋ํ์ต๋๋ค. ์ฑ์ ์์ํ ๋ socket.io-client ๋ฐ engine.io-client์์ ๊ฒฝ๊ณ ๋ฐ ์ค๋ฅ๊ฐ ํ์๋ ๊ฒ์ผ๋ก ์์ํ์ง ๋ชปํ์ต๋๋ค.
๋๋ฝ๋ ๋ชจ๋์ npm ํจํค์ง์ ์ผ๋ถ๊ฐ ์๋์ด์ผ ํฉ๋๊น?
๊ฒฝ๊ณ :
WARNING in ./~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in C:\Data\captchatheprize.com\dev\gamewww\node_modules\socket.io-client\node_modules\engine.io-clie
nt\node_modules\ws\lib
@ ./~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js 10:19-40
WARNING in ./~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in C:\Data\captchatheprize.com\dev\gamewww\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\lib
@ ./~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js 10:19-44
์ค๋ฅ:
ERROR in ./~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js
Module not found: Error: Cannot resolve module 'tls' in C:\Data\captchatheprize.com\dev\gamewww\node_modules\socket.io-client\node_modules\engine.io-client\node
_modules\ws\lib
@ ./~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js 15:10-24
ERROR in ./~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js
Module not found: Error: Cannot resolve module 'fs' in C:\Data\captchatheprize.com\dev\gamewww\node_modules\socket.io-client\node_modules\engine.io-client\node_
modules\ws\node_modules\options\lib
@ ./~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js 6:9-22
@ADumaine 1.3.7์ ๋ฌธ์ ๊ฐ ์์ต๋๊น? ์ฌ๊ธฐ์์ ํด๊ฒฐ๋ ๋๊น์ง ๊ณ์ ์ฌ์ฉํ์ง ์์ผ๋ฉด ๋ฉ๋๋ค.
@Levino No 1.3.7์๋ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. 1.4.3์ ์ค์ ๋ก ์๋ํฉ๋๋ค. ์๋ฒ์ ์ฐ๊ฒฐํ๊ณ ๋ฐ์ดํฐ๋ฅผ ์ ๋ฌํ์ง๋ง ์ฌ์ ํ ๋ก์ปฌ์์ ๊ฐ๋ฐ ์ค์ด๋ฉฐ tls์ ๊ฐ์ ๊ฒ์ ์ฌ์ฉํ์ง ์์ต๋๋ค. ์ง๊ธ์ 1.4.3์ผ๋ก ๋๊ณ ์ ๋ฐ์ดํธ๋ฅผ ํ ์คํธํ๊ฑฐ๋ ์ ๋ฐ์ดํธ๊ฐ ์๋ ๊ฒฝ์ฐ ๋๋๋ฆฌ๋ฉฐ ์ค๋นํ ์ค๋น๊ฐ ๋์์ต๋๋ค.
์ค๋ ๋ ์๊ตฌ์ ์ธ ์์ ์ฌํญ์ ๊ฒ์ํฉ๋๋ค!
์์ฒญ๋.
1.4.4 ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํฉ๋๋ค. ๊ฐ์ฌ ํด์!
1.4.4 ๋๋ ๊ทธ๊ฒ์ ๊ณ ์ณค๋ค!. @latest์ ํจ๊ป npm์ ์ฌ์ฉํ์ต๋๋ค. ์๋ฒ๋ฅผ ๋ค์ ์์ํ๋๋ฐ ๊ฒฝ๊ณ ๋ ์ค๋ฅ๊ฐ ์์์ต๋๋ค.
๊ฐ์ฌ ํด์!
์ฌ์ ํ ๋์๊ฒ ๋ฌธ์ ๊ฐ ์์ง๋ง ์ต์ socket.io-client, ws ๋ฐ webpack์ผ๋ก ์ ๋ฐ์ดํธํ์ผ๋ฉฐ ๋ค์์ ์ป์ต๋๋ค.
WARNING in ./~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in /home/test/Projects/B_Components/node_modules/ws/lib
@ ./~/ws/lib/BufferUtil.js 10:19-40
WARNING in ./~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in /home/test/Projects/B_Components/node_modules/ws/lib
@ ./~/ws/lib/Validation.js 10:19-44
WARNING in ./~/mymodule-services/~/sails.io.js/~/request/lib/optional.js
Critical dependencies:
3:11-26 the request of a dependency is an expression
@ ./~/mymodule-services/~/sails.io.js/~/request/lib/optional.js 3:11-26
webpack: bundle is now VALID.
@mrvini ์ฌํํ๋ ๋จ๊ณ๋ ๋ฌด์์ ๋๊น? ๋๋ ์์ผ๊ณผ ํจ๊ป ๋ค์์ ๊ฐ์ง๊ณ ์์ต๋๋ค. [email protected] :
damien<strong i="8">@home</strong>:~/git/socket.io-client$ webpack . bundle.js
Hash: 321bb2158ab30d957364
Version: webpack 1.12.11
Time: 685ms
Asset Size Chunks Chunk Names
bundle.js 195 kB 0 [emitted] main
[0] ./lib/index.js 1.66 kB {0} [built]
[1] ./lib/url.js 1.61 kB {0} [built]
[14] ./lib/manager.js 12 kB {0} [built]
[43] ./lib/socket.js 7.54 kB {0} [built]
[46] ./lib/on.js 370 bytes {0} [built]
+ 46 hidden modules
@globexdesigns @ADumaine :ํํธ:
@darrachequesne , ๋ค์ ์ค์ ์ด ์์ต๋๋ค.
๋
ธ๋: v4.2.3
sail.io.js ๋ฐ socket.io-client ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๋ก์ปฌ ๋ชจ๋์ด ์์ต๋๋ค.
sails.io.js: 0.12.2
socket.io ํด๋ผ์ด์ธํธ: 1.4.4
์ด ๋ชจ๋์ ์์ฉ ํ๋ก๊ทธ๋จ์ ํฌํจํ๊ณ ์นํฉ ์๋ฒ๋ฅผ ์คํ ์ค์
๋๋ค.
์นํฉ: 1.12.11
์นํฉ ๊ฐ๋ฐ ์๋ฒ: 1.14.1
webpack .bundle.js๋ฅผ ์คํํ๋ฉด ๋ชจ๋ ๊ฒ์ด ์ข์ ๋ณด์ด์ง๋ง webpack dev ์๋ฒ๋ก ์คํํ๋ ค๊ณ ํ๋ฉด ์์์ ์ธ๊ธํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
@mrvini ์ฃ์กํฉ๋๋ค. ์ฌํํ ์ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
damien<strong i="7">@home</strong>:~/test$ npm install [email protected]
[email protected] node_modules/socket.io-client
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected] ([email protected])
โโโ [email protected] ([email protected])
โโโ [email protected] ([email protected], [email protected], [email protected], [email protected])
โโโ [email protected] ([email protected])
โโโ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
damien<strong i="8">@home</strong>:~/test$ webpack-dev-server --port 9000
Hash: 396f0bfb9d565b6f60f0
Version: webpack 1.12.11
Time: 19ms
webpack: bundle is now VALID.
http://localhost:9000/webpack-dev-server/
webpack result is served from /
content is served from /home/damien/test
๋ด๊ฐ ์ฌ๊ธฐ์์ ๋ญ๊ฐ๋ฅผ ๋์น๊ณ ์์ต๋๊น?
์ค! [email protected]
๋ [email protected]
์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค :grinning: : https://github.com/balderdashy/sails.io.js/blob/master/dependencies/socket.io.min.js# L1
๋ฐ๋ผ์ ๋ฌธ์ .
@darrachequesne ์๊ฒ
Critical dependencies:
3:11-26 the request of a dependency is an expression
@ ./~/mymodule-services/~/sails.io.js/~/request/lib/optional.js 3:11-26
์ฐธ๊ณ ๋ก ์ด์ํ ์ ์ WS ๋ฒ์ 0.8.1์์ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ค์ ์๋ํฉ๋๋ค, ๊ฐ์ฌํฉ๋๋ค!
์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง์ ๋๋ค...๋ง์ ์ข ์์ฑ์ด ๋๋ฝ๋์์ต๋๋ค...
ERROR in ./~/sails.io.js/~/request/request.js
Module not foun @ ./~/sails.io.js/~/request/request.js 30:10-24
ERROR in ./~/sails.io.js/~/request/~/forever-agent/index.js
Module not found
@ ./~/sails.io.js/~/request/~/forever-agent/index.js 6:10-24
ERROR in ./~/sails.io.js/~/request/~/forever-agent/index.js
Module not found: Error
@ ./~/sails.io.js/~/request/~/forever-agent/index.js 7:10-24
ERROR in ./~/sails.io.js/~/request/~/mime/mime.js
Module not found
@ ./~/sails.io.js/~/request/~/mime/mime.js 2:9-22
ERROR in ./~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js
Module not found
@ ./~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js 15:10-24
ERROR in ./~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js
Module not found
@ ./~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js 6:9-22
๋๋ ์ด๊ฒ์ ์์ง๋ ๋ณด๊ณ ์๋ค:
[0] WARNING in ./~/sails.io.js/~/request/lib/optional.js
[0] Critical dependencies:
[0] 3:11-26 the request of a dependency is an expression
[0] @ ./~/sails.io.js/~/request/lib/optional.js 3:11-26
ํจํค์ง:
"sails.io.js": "^0.13.3",
"socket.io": "^1.4.4",
"socket.io-client": "^1.4.4",
์ด ์นํฉ ๊ตฌ์ฑ๋ ์๋ํ์ต๋๋ค.
module: {
noParse: ['ws']
},
externals: ['ws']
+1
+1
+1
NS:
module: {
....
noParse: ['ws']
},
externals: ['ws']
๊ณ ์น ๊ฒ ๊ฐ์ง ์์ต๋๋ค. ์ด์ ws ๋ชจ๋์ด ์ ์๋์ง ์์์ต๋๋ค.
webpack version : 1.13.0
socket.io-client version : 1.4.4
๋ฒ์ 1.4.x ์ดํ๋ก๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋ด ์ํ ํ๋ก์ ํธ๋ ๋ค์ ๋ฒ์ ์ ๊ฐ๋จํ TODO ์ฑ์
๋๋ค.
์นํฉ ๊ตฌ์ฑ
module: {
noParse: ['ws']
},
node: {
tls: "empty"
},
externals: ['fs','ws']
์ผ๋ถ ์ค๋ฅ ๋ฐ ๊ฒฝ๊ณ ๋ฅผ ์ ๊ฑฐํ๋ ๋ฐ ๋์์ด ๋์ง๋ง ์ฌ์ ํ ๋ค์ ๊ฒฝ๊ณ ๋ฐ ์ค๋ฅ๊ฐ ํ์๋ฉ๋๋ค.
WARNING in ./~/socket.io-client/socket.io.js
Critical dependencies:
1:475-482 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./~/socket.io-client/socket.io.js 1:475-482
ERROR in ./~/socket.io-client/package.json
Module parse failed: C:\test\client\node_modules\socket.io-client\package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)
at Parser.pp.raise (C:\test\client\node_modules\acorn\dist\acorn.js:920:13)
at Parser.pp.unexpected (C:\test\client\node_modules\acorn\dist\acorn.js:1483:8)
at Parser.pp.semicolon (C:\test\client\node_modules\acorn\dist\acorn.js:1462:73)
at Parser.pp.parseExpressionStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1976:8)
at Parser.pp.parseStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1754:188)
at Parser.pp.parseBlock (C:\test\client\node_modules\acorn\dist\acorn.js:1991:21)
at Parser.pp.parseStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1735:19)
at Parser.pp.parseTopLevel (C:\test\client\node_modules\acorn\dist\acorn.js:1648:21)
at Parser.parse (C:\test\client\node_modules\acorn\dist\acorn.js:1616:17)
at Object.parse (C:\test\client\node_modules\acorn\dist\acorn.js:882:44)
@ ./~/socket.io/lib/index.js 10:20-55
ERROR in ./~/accepts/~/mime-db/db.json
Module parse failed: C:\test\client\node_modules\accepts\node_modules\mime-db\db.json Unexpected token (2:40)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:40)
at Parser.pp.raise (C:\test\client\node_modules\acorn\dist\acorn.js:920:13)
at Parser.pp.unexpected (C:\test\client\node_modules\acorn\dist\acorn.js:1483:8)
at Parser.pp.semicolon (C:\test\client\node_modules\acorn\dist\acorn.js:1462:73)
at Parser.pp.parseExpressionStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1976:8)
at Parser.pp.parseStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1754:188)
at Parser.pp.parseBlock (C:\test\client\node_modules\acorn\dist\acorn.js:1991:21)
at Parser.pp.parseStatement (C:\test\client\node_modules\acorn\dist\acorn.js:1735:19)
at Parser.pp.parseTopLevel (C:\test\client\node_modules\acorn\dist\acorn.js:1648:21)
at Parser.parse (C:\test\client\node_modules\acorn\dist\acorn.js:1616:17)
at Object.parse (C:\test\client\node_modules\acorn\dist\acorn.js:882:44)
@ ./~/accepts/~/mime-db/index.js 11:17-37
๊ทธ๋ฌ๋ ์ค๋ฅ๊ฐ ํ์๋๋๋ผ๋ ํ๋ก์ ํธ์ ์์ผ์ ์ฌ์ ํ โโ์ฌ๋ฌ ๋ธ๋ผ์ฐ์ ์์ ์๋ํ ๋๋ก ์๋ํฉ๋๋ค.
๋ํ ๋๊ตฐ๊ฐ๊ฐ ์ค๋ฅ๋ฅผ ์ฌํํ๋ ค๋ ๊ฒฝ์ฐ Github TODO ์ํ์ ์ถ๊ฐํ์ต๋๋ค.
1.4.6์์๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. @ghiscoding๊ณผ ๋์ผํ ์ค๋ฅ๋ฅผ ์์ ํฉ๋๋ค. ์ค๋ ๋์์ ์์์ ์ค๋ช
ํ ๋๋ก noParse
๋ฐ externals
ํ์ต๋๋ค. ๋๋ฒ๊น
์ ๋์์ด ๋ ์ ์๋ ๋งค์ฐ ๊ฐ๋จํ ์ฑ ์ด ์์ต๋๋ค.
๊ฒ์๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ ์ผํ ์ข ์์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
"socket.io": "^1.4.6",
"socket.io-client": "^1.4.6"
์ค๋ฅ๋ฅผ ์ฌํํ๋ ค๋ฉด ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ค์ด๋ก๋ํ๋ ค๋ฉด npm install
๋ฅผ ์คํํ ๋ค์ npm prepublish
@dbslone ๊ฐ์ฌํฉ๋๋ค. ๋ํ ํฅํ ๋ฌธ์ ๋ฅผ ํผํ๊ธฐ ์ํด webpack์ผ๋ก ํ๋ก์ ํธ๋ฅผ ๋น๋ํ๋ CI ํ ์คํธ๊ฐ ์์ด์ผ ํฉ๋๋ค.
Socket.IO 1.4.6, webpack 1.13.0์์ ๋์ผํ ๊ฒฝ๊ณ .
WARNING in ./~/socket.io-client/socket.io.js
Critical dependencies:
1:475-482 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./~/socket.io-client/socket.io.js 1:475-482
WARNING in ./~/express/lib/view.js
Critical dependencies:
78:29-56 the request of a dependency is an expression
@ ./~/express/lib/view.js 78:29-56
WARNING in ./~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in /home/rbozan/Git/mooiboymmo/server/node_modules/ws/lib
@ ./~/ws/lib/BufferUtil.js 10:19-40
WARNING in ./~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in /home/rbozan/Git/mooiboymmo/server/node_modules/ws/lib
@ ./~/ws/lib/Validation.js 10:19-44
var webpack = require("webpack");
module.exports = {
output: {
filename: "server.min.js"
},
target: "node",
module: {
loaders: [
{ test: /\.json$/, loader: "json-loader" }
]
}
};
ํ์ฌ ์ด์ ๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? noParse
๋ฐ externals
์ถ๊ฐํ๋ ค๊ณ ์๋ํ์ง๋ง ์ฌ์ ํ ๋ฐ๋ก ์์ ์ค๋ฅ๊ฐ ํ์๋ฉ๋๋ค. socket.io 1.4.6, ์นํฉ 1.13.1 ์ฌ์ฉ
import io from 'socket.io-client/socket.io'
์ ์๊ฒ ํจ๊ณผ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค ( import io from 'socket.io'
์ ๋ฐ๋)
๋๋ ์์ง๋ ์ป๋๋ค
WARNING in ./~/socket.io-client/socket.io.js
Critical dependencies:
1:475-482 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
ํ์ง๋ง ... ์ ์ด๋ ์๋ํฉ๋๋ค
@WestleyArgentum ์ ๋ ์ฌ์ค ์ด๊ฒ ๋๋ฌธ์ ๊ณ ์ฌํ๊ณ ์์๋๋ฐ, read me์์ ์ฌ์ฉ๋ฒ ์น์ ์ ์ฝ์์ต๋๋ค. ์๋ฒ์์ socket.io๋ฅผ ์ฌ์ฉํ๋ ํ ๊ณ์ ์งํํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
socket.io-client์ ๋ ๋ฆฝ ์คํํ ๋น๋๋ socket.io ์๋ฒ์ ์ํด /socket.io/socket.io.js๋ก ์๋ ๋ ธ์ถ๋ฉ๋๋ค.
๋ด html ๋ฐ ๋ฌธ์์ ํค๋์ <script type="text/javascript" charset="utf-8" src="/socket.io/socket.io.js"></script>
๋ฅผ ์ถ๊ฐํ๊ณ io๋ฅผ ์ ์ญ์ผ๋ก ๋
ธ์ถํ์ผ๋ฏ๋ก ๊ฐ์ ธ์ฌ ํ์๊ฐ ์์ต๋๋ค.
์์ผ.IO: 1.4.6
์นํฉ: 1.13.0
Webpack์ config์์ ๋์์ผ๋ก '๋
ธ๋'๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
WARNING in ./~/socket.io-client/socket.io.js
Critical dependencies:
1:475-482 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./~/socket.io-client/socket.io.js 1:475-482
WARNING in ./~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in C:\maestro\frontend\node_modules\ws\lib
@ ./~/ws/lib/BufferUtil.js 10:19-40
WARNING in ./~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in C:\maestro\frontend\node_modules\ws\lib
@ ./~/ws/lib/Validation.js 10:19-44
@omerts ์ ์ ํํ ๊ฐ์ ๋ฌธ์ ๊ฐ ์ฌ๊ธฐ์ ์์ต๋๋ค ... ๋๊ตฌ๋ ์ง ์์ ์ฌํญ์ ์๊ฐํด
์ด๊ฒ์ request/request/issues/1529์ ๋ชจํธํ๊ฒ ๊ด๋ จ๋์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ํ websocket
๋ฐ ws
ํจํค์ง ๋ชจ๋์์ ์ด๊ฒ์ ์ป์ต๋๋ค.
ws
์ฌ์ฉํ์ฌ ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์์ผ.IO: 1.7.3
์นํฉ: 2.2.1
๋ชจ๋์ ์ฐพ์ ์ ์์: ์ค๋ฅ: 'socket.io-client/package'๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
@zweifisch , ๊ตฌ์ฑ์ json ๋ก๋๋ฅผ ํฌํจํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ญ์์ค.
์ฌ์ ํ "WARNING in ./~/engine.io/lib/server.js Critical ์ข ์์ฑ: ์ข ์์ฑ ์์ฒญ์ ํํ์์ ๋๋ค" ๋ฐ ์์ ์ฌ๋๋ค๊ณผ ์ ์ฌํ ๋ค๋ฅธ ํญ๋ชฉ์ด ์์ต๋๋ค.
์ ๋ Angular2๋ฅผ ์ฌ์ฉํฉ๋๋ค. ์๋ง๋ ๊ตฌ์ฑ์ด ๋์์ด ๋ ๊ฒ์ ๋๋ค.
const path = require('path');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const postcssUrl = require('postcss-url');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { NoEmitOnErrorsPlugin, LoaderOptionsPlugin, WatchIgnorePlugin } = require('webpack');
const { BaseHrefWebpackPlugin } = require('@angular/cli/plugins/webpack');
const { CommonsChunkPlugin } = require('webpack').optimize;
const { AotPlugin } = require('@ngtools/webpack');
const nodeModules = path.join(process.cwd(), 'node_modules');
const entryPoints = ["inline","polyfills","sw-register","styles","vendor","main"];
const baseHref = undefined;
const deployUrl = undefined;
module.exports = {
"devtool": "source-map",
"resolve": {
"extensions": [
".ts",
".js",
".json"
],
"modules": [
"./node_modules"
],
"alias": {
"config": "config/config.dev.js"
}
},
"resolveLoader": {
"modules": [
"./node_modules"
]
},
"entry": {
"main": [
"./app/main.ts"
],
"polyfills": [
"./app/polyfills.ts"
],
"styles": [
"./dist/style.dev.css"
]
},
"output": {
"path": path.join(process.cwd(), "dist/dev"),
"filename": "[name].bundle.js",
"sourceMapFilename": "[name].bundle.js.map",
"chunkFilename": "[id].chunk.js"
},
"module": {
"rules": [
{
"enforce": "pre",
"test": /\.js$/,
"loader": "source-map-loader",
"exclude": [
/\/node_modules\//
]
},
{
"test": /\.json$/,
"loader": "json-loader"
},
{
"test": /\.html$/,
"loader": "raw-loader"
},
{
"test": /\.(eot|svg)$/,
"loader": "file-loader?name=[name].[hash:20].[ext]"
},
{
"test": /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
"loader": "url-loader?name=[name].[hash:20].[ext]&limit=10000"
},
{
"exclude": [
path.join(process.cwd(), "dist/style.dev.css")
],
"test": /\.css$/,
"loaders": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":true,\"importLoaders\":1}",
"postcss-loader"
]
},
{
"exclude": [
path.join(process.cwd(), "dist/style.dev.css")
],
"test": /\.less$/,
"loaders": [
"exports-loader?module.exports.toString()",
"css-loader?{\"sourceMap\":true,\"importLoaders\":1}",
"postcss-loader",
"less-loader"
]
},
{
"include": [
path.join(process.cwd(), "dist/style.dev.css")
],
"test": /\.css$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}", // Don't make sourceMap true, because it will break fonts loading
"postcss-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"include": [
path.join(process.cwd(), "dist/style.dev.css")
],
"test": /\.less$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}", // Don't make sourceMap true, because it will break fonts loading
"postcss-loader",
"less-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"test": /\.ts$/,
"loader": "@ngtools/webpack"
}
],
/*noParse: [
/\/ws\//,
/socket\.io\/lib\/index\.js/
]*/
},
"plugins": [
new NoEmitOnErrorsPlugin(),
new ProgressPlugin(),
new ProvidePlugin({
$:"jquery",
jQuery:"jquery"
}),
new HtmlWebpackPlugin({
"template": "./index.html",
"filename": "./index.html",
"hash": false,
"inject": true,
"compile": true,
"favicon": false,
"minify": false,
"cache": true,
"showErrors": true,
"chunks": "all",
"excludeChunks": [],
"title": "Webpack App",
"xhtml": true,
"chunksSortMode": function sort(left, right) {
let leftIndex = entryPoints.indexOf(left.names[0]);
let rightindex = entryPoints.indexOf(right.names[0]);
if (leftIndex > rightindex) {
return 1;
}
else if (leftIndex < rightindex) {
return -1;
}
else {
return 0;
}
}
}),
new BaseHrefWebpackPlugin({}),
new CommonsChunkPlugin({
"name": "inline",
"minChunks": null
}),
new CommonsChunkPlugin({
"name": "vendor",
"minChunks": (module) => module.resource && module.resource.startsWith(nodeModules),
"chunks": [
"main"
]
}),
new ExtractTextPlugin({
"filename": "[name].bundle.css",
"disable": true
}),
new LoaderOptionsPlugin({
"sourceMap": true,
"options": {
"postcss": [
autoprefixer(),
postcssUrl({"url": (URL) => {
// Only convert absolute URLs, which CSS-Loader won't process into require().
if (!URL.startsWith('/')) {
return URL;
}
// Join together base-href, deploy-url and the original URL.
// Also dedupe multiple slashes into single ones.
return `/${baseHref || ''}/${deployUrl || ''}/${URL}`.replace(/\/\/+/g, '/');
}})
],
"lessLoader": {
"sourceMap": true
},
"context": ""
}
}),
new AotPlugin({
"mainPath": "app/main.ts",
"hostReplacementPaths": {},
"exclude": [],
"tsConfigPath": "tsconfig.json",
"skipCodeGeneration": true
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
reportFilename: 'analyzer/report.html',
}),
new WatchIgnorePlugin([
path.resolve(__dirname, './dist/dev/analyzer'),
path.resolve(__dirname, './node_modules'),
])
],
"node": {
"fs": "empty",
"global": true,
"crypto": "empty",
"tls": "empty",
"net": "empty",
"process": true,
"module": false,
"clearImmediate": false,
"setImmediate": false
}
};
ํฌํจํ ๋ ๊ฒฝ๊ณ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
import * as io from "socket.io-client";
๋์ ์
import * as io from "socket.io";
๊ทธ๋๋ #1088๊ณผ ๊ฐ์ ํ๋์ ํ๊ณ ์์ต๋๋ค. ๋ฒ๊ทธ๊ฐ ์๋ ์ต์ ์ฑ์ ํด๋น ๋ฌธ์ ์ค๋ ๋์ ์์ต๋๋ค.
_ํธ์ง: ๋ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค. socket.io ๋๋ฌธ์ด ์๋๋๋ค._
@metamaker ์ ๋ง ๊ฐ์ฌํฉ๋๋ค :+1:
์ดํ socket.io ๋ฐ webpack 2์์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
Module not found: Error: Can't resolve 'socket.io-client/package' in 'xxx/server2/node_modules/socket.io/lib'
์์ ํ๋ ค๋ฉด socket.io lib/index.js ์์ค ํ์ผ์์ package --> package.json
๋ฅผ ๋ณ๊ฒฝํด์ผ ํฉ๋๋ค.
var clientVersion = require('socket.io-client/package.json').version;
์นํฉ.config.js
let path = require('path');
const { GlobCopyWebpackPlugin } = require('@angular/cli/plugins/webpack');
module.exports = {
devtool: false,
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, 'src')
],
extensions: ['.ts', '.js'],
alias: {
// FIXME: Module not found: Error: Can't resolve 'socket.io-client/package' in '/Developer/Work/iot/hub/server2/node_modules/socket.io/lib'
// "socket.io-client/package": "empty-module",
"hiredis": "empty-module",
}
},
target: 'node',
resolveLoader: {
modules: [
'node_modules'
]
},
entry: {
main: './src/index',
vendor: [
'nest.js',
'rxjs'
]
},
output: {
path: path.resolve(__dirname, './dist/build'),
filename: '[name].server.bundle.js',
chunkFilename: "[id].server.chunk.js"
},
module: {
rules: [
{ test: /\.ts$/, use: 'ts-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.(eot|svg)$/, loader: 'file-loader?name=[name].[hash:20].[ext]' },
{ test: /\.js.map/, loader: 'raw-loader' },
]
},
"plugins": [
new GlobCopyWebpackPlugin({
"patterns": [
"config",
"data"
],
"globOptions": {
"cwd": "./",
"dot": true,
"ignore": "**/.gitkeep"
}
}),
]
};
์ฌ๊ธฐ์์ ์์ ๋ฅผ ์ฐธ์กฐํ์ญ์์ค: https://github.com/socketio/socket.io/tree/master/examples/webpack-build
์ฌ๋ฐ๋ฅธ ๊ตฌ๋ฌธ์ import io from 'socket.io-client';
์ฌ์ผ ํฉ๋๋ค.
๋ํ Can't resolve 'socket.io-client/package'
์ค๋ฅ๋ https://github.com/socketio/socket.io/pull/2960์์ ์์ ํด์ผ ํฉ๋๋ค
๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค! ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ๋ฌธ์ ๋ฅผ ์ฌํํ๋ ์๋ฅผ ๋ค์ด ๋ฌธ์ ๋ฅผ ๋ค์ ์ด์ด์ฃผ์ธ์. ๊ฐ์ฌํฉ๋๋ค!
@darrachequesne
๋ด๊ฐ ๊ฐ์ ธ ์ค๋ ค๊ณ ํ ๋
import io from 'socket.io-client'
TS์์ ๋ชจ๋์ ๊ธฐ๋ณธ ๋ด๋ณด๋ด๊ธฐ๊ฐ ์๋ค๊ณ ์๋ ค์ค๋๋ค.
@ํฌ๋ ๋ถ
typescript์ ๋ํ ์ ํ์ ์ถ๊ฐํฉ๋๋ค.
npm i @types/socket.io-client
@kdw3lch
์๋์ค, ์๋ํ์ง ์์ต๋๋ค. ์ด๋ฏธ ๋ฒ์ 1.4.29์ ์ ํ์ด ์๊ณ socket.io-client๋ฅผ 1.7.3์์ 2.0.3์ผ๋ก ์ ๊ทธ๋ ์ด๋ํ์ง๋ง ์ฌ์ ํ ๋์ผํ ๋ฌธ์ ์ ๋๋ค.
๋ด tsconfig.json์ด ์๋ชป๋์์ ์ ์์ต๋๋ค. ์ด๋ค ์์ด๋์ด๊ฐ ์์ต๋๊น?
@crebuh ์ข ๋ ์์ธํ ์ฝ์ด
import * as io from 'socket.io-client'
webpack ^2.0.0 ๋ฐ ํจํค์ง์ socket.io๊ฐ ์๋ ๊ฒฝ์ฐ ์ด ๋ฌธ์ ๊ฐ ํ์๋ฉ๋๋ค. ๋ด๊ฐ ์นด๋ฅด๋ง๋ฅผ ์คํํ ๋ ๋๋ ์ด๊ฒ์ ์ป์ต๋๋ค.
์ฌ๊ธฐ์์ ITO ๋๋ฒ๊น ์ ์ด๋๋ก ๊ฐ์ผํ ์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๋ด package.json์ ์ข ์์ฑ์ socket.io-client๋ฅผ ์ถ๊ฐํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๊ธฐ์กด ํ๋ก์ ํธ๋ฅผ ์ฒดํฌ ์์ ํ ๋ ๋น์ทํ ๋ฌธ์ ๊ฐ์์์ต๋๋ค.
npm -i๋ฅผ ์คํํ๋ฉด ๋ชจ๋ ์ข
์์ฑ์ด ์ค์น๋์์ง๋ง ๋ค์ ์ค๋ฅ๊ฐ ๋ํ๋ฉ๋๋ค.
" 'engine.io-client'๋ฅผ ํ์ธํ ์ ์์ต๋๋ค."
socket.io-client๋ฅผ ์ค์นํ์ฌ ์์ ๋์์ต๋๋ค.
npm i socket.io-ํด๋ผ์ด์ธํธ
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํฌํจํ ๋ ๊ฒฝ๊ณ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
๋์ ์
๊ทธ๋๋ #1088๊ณผ ๊ฐ์ ํ๋์ ํ๊ณ ์์ต๋๋ค. ๋ฒ๊ทธ๊ฐ ์๋ ์ต์ ์ฑ์ ํด๋น ๋ฌธ์ ์ค๋ ๋์ ์์ต๋๋ค.
_ํธ์ง: ๋ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค. socket.io ๋๋ฌธ์ด ์๋๋๋ค._