Skip to content

using coffee-script with webpack #4276

@Radivarig

Description

@Radivarig

When I require with webpack var CoffeeScript = require ('coffee-script') I get the following output

WARNING in ./~/coffee-script/lib/coffee-script/coffee-script.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/coffee-script/lib/coffee-script/coffee-script.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/coffee-script/lib/coffee-script/coffee-script.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/coffee-script/lib/coffee-script/coffee-script.js
Critical dependencies:
175:42-49 require function is used in a way in which dependencies cannot be statically extracted
179:26-33 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/coffee-script/lib/coffee-script/coffee-script.js 175:42-49 179:26-33

WARNING in ./~/coffee-script/lib/coffee-script/register.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/coffee-script/lib/coffee-script/register.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/coffee-script/lib/coffee-script/browser.js
Critical dependencies:
8:25-32 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/coffee-script/lib/coffee-script/browser.js 8:25-32

ERROR in ./~/coffee-script/bin/coffee
Module parse failed: /path_to_repo/node_modules/coffee-script/bin/coffee Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:0)
    at Parser.pp.raise (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:923:13)
    at Parser.pp.getTokenFromCode (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:2831:8)
    at Parser.pp.readToken (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:2526:15)
    at Parser.pp.nextToken (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:2518:71)
    at Parser.parse (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:1631:10)
    at Object.parse (/path_to_repo/node_modules/webpack/node_modules/acorn/dist/acorn.js:885:44)
    at Parser.parse (/path_to_repo/node_modules/webpack/lib/Parser.js:902:15)
    at DependenciesBlock.<anonymous> (/path_to_repo/node_modules/webpack/lib/NormalModule.js:104:16)
    at DependenciesBlock.onModuleBuild (/path_to_repo/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
    at nextLoader (/path_to_repo/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
 @ ./~/coffee-script/lib/coffee-script/register.js 52:13-48

ERROR in ./~/coffee-script/lib/coffee-script/coffee-script.js
Module not found: Error: Cannot resolve module 'module' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/coffee-script.js 129:23-40 169:17-34

ERROR in ./~/coffee-script/lib/coffee-script/register.js
Module not found: Error: Cannot resolve module 'child_process' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/register.js 7:18-42

ERROR in ./~/coffee-script/lib/coffee-script/register.js
Module not found: Error: Cannot resolve module 'module' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/register.js 25:13-30

ERROR in ./~/coffee-script/lib/coffee-script/command.js
Module not found: Error: Cannot resolve module 'child_process' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/command.js 16:8-32

ERROR in ./~/coffee-script/lib/coffee-script/grammar.js
Module not found: Error: Cannot resolve module 'jison' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/grammar.js 5:11-27

ERROR in ./~/coffee-script/lib/coffee-script/repl.js
Module not found: Error: Cannot resolve module 'repl' in /path_to_repo/node_modules/coffee-script/lib/coffee-script
 @ ./~/coffee-script/lib/coffee-script/repl.js 11:13-28
webpack: bundle is now VALID.

if I include a fatter 160kb local file of coffer-script-1.9.3-min.js everything works but I'd like to avoid adding library build to source if possible.

Any ideas? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions