Giter VIP home page Giter VIP logo

flow-webpack-plugin's People

Contributors

aaronjensen avatar happylynx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flow-webpack-plugin's Issues

Extra flow validation errors

When there are flow errors coming from flowOutput I always get extra errors following webpack bundle stats. These particular errors should have been resolved by mapping 'less' in .flowconfig but for some reason I still get them here. If I fix all flow errors I don't get these extra errors. If run flow status there are only the regular error messages.

Webpack is still running and the plugin is not failing but I should scroll my terminal every single time to check what I need to see.

image

#.flowconfig
[ignore]
<PROJECT_ROOT>/www/.*
<PROJECT_ROOT>/gulp/.*
<PROJECT_ROOT>/tests/.*
[include]
<PROJECT_ROOT>/src/.*
[libs]
flow-typed
[options]
module.file_ext=.js
server.max_workers=3
module.name_mapper.extension='less' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='sass' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='png' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
module.name_mapper.extension='jpg' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
module.name_mapper.extension='jpeg' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
module.name_mapper.extension='gif' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable

using:
[email protected]
[email protected]

Webpack4 compatibility?

at the moment I receive a warning on Webpack4

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

Is "use strict" missing?

.../flow-webpack-plugin/dist/index.js:24
    let errorToReport = undefined
    ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)

So it works fine if I manually add use strict, is there way around this?

Thanks!

Ability to run flow on bundles

It would be great if there is a boolean option, when we set it, it runs the flow after webpack compilation.
In this case, we have the options to run it on the bundles.

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Hello,

I am unable to run this plugin. I followed the step process on readme, and after starting webpack it crashes immediately

/path/to/app/node_modules/flow-webpack-plugin/dist/index.js:22
let errorToReport = undefined
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Module._extensions..js (module.js:422:10)
at Object.require.extensions.(anonymous function) [as .js] (/path/to/app/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (/path/to/app/webpack/dev.js:8:1)
at Module._compile (module.js:413:34)
at loader (/path/to/app/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/path/to/app/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)

My current dependencies are listed bellow

"devDependencies": {
...
"flow-bin": "^0.40.0",
"flow-webpack-plugin": "^0.3.6",
"webpack": "^2.2.1",
}

`flowPath` doesn't allow you to omit local flow

If you set flowPath to a globally installed flow without any local flow, this plugin still throws an error like:

Error: `flow` can't be found. Please either install it (`npm install --save-dev flow-bin`) or set `flowPath` option
    at FlowWebpackPluginError (.../flow-webpack-plugin/dist/index.js:262:1)
    at getLocalFlowPath (.../flow-webpack-plugin/dist/index.js:200:28)
    at applyOptionsDefaults (.../flow-webpack-plugin/dist/index.js:254:19)
    at new FlowWebpackPlugin (.../flow-webpack-plugin/dist/index.js:27:20)
    ...

.

I'd expect to be able to direct the plugin to my global flow and for this to all work without any local flow install.

I think the reason that it fails is that applyOptionDefaults calls getLocalFlowPath too eagerly. That function throws the exception but is always called---even when a flowPath is provided. Instead, it should be a thunk or something analogous and only called if flowPath is missing.

webpack --watch process terminates

With a configuration like

new FlowWebpackPlugin({
  failOnError: true
})

and running webpack -w the webpack process is termintated when Flow errors exist with:

Flow validation failed.
Error: path/to/source.js:42
... more flow error details

I think this is due to the implementation of afterUserCallback in https://github.com/happylynx/flow-webpack-plugin/blob/master/src/index.js#L156-L168. There even is a comment stating

/*
 * argument passed to callback() causes webpack to immediately stop, even in watch mode,
  * don't emit assets, and set return code to 1
  */

There is only a check for plugin.options.failOnError. IMO the code would need to check if it is running in watch mode and just continue by calling webpackCallback() without arguments to avoid stopping the process.

Note: The behaviour is the same, even when explicitly specifying:

new FlowWebpackPlugin({
  failOnError: true,
  failOnErrorWatch: false
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.