-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot resolve module 'fs' #8
Comments
You removed the default |
I am not sure what you mean, however here is my webpack.config.coffee # See webpack.config.js for more examples:
# https://github.com/webpack/webpack-with-common-libs/blob/master/webpack.config.js
path = require 'path'
webpack = require 'webpack'
CommonsChunkPlugin = require "webpack/lib/optimize/CommonsChunkPlugin"
module.exports =
contentBase: "#{__dirname}/src/"
cache: true
entry:
app: './src/coffee/app'
head: './src/coffee/head'
output:
path: path.join(__dirname, 'build')
publicPath: '/'
filename: '[name].js'
chunkFilename: '[name].js'
plugins:[
new CommonsChunkPlugin "commons.js", ["app"]
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin( "bower.json", ["main", ["main", "1"]], )
], ["normal", "loader"])
]
module:
loaders: [
{
test: /\.coffee$/
loader: 'coffee-loader'
}
{
test: /\.json$/
loader: 'json-loader'
}
{
test: /\.css$/
loader: 'style-loader!css-loader'
}
{
test: /\.less$/
loader: 'style-loader!css-loader!less-loader'
}
{
test: /\.jade$/
loader: 'jade-loader'
}
{
test: /\.html$/
loader: 'html-loader'
}
{
test: /\.woff$/
loader: 'url-loader?prefix=font/&limit=5000&minetype=application/font-woff'
}
{
test: /\.ttf$/
loader: 'file-loader?prefix=font/'
}
{
test: /\.eot$/
loader: 'file-loader?prefix=font/'
}
{
test: /\.svg$/
loader: 'file-loader?prefix=font/'
}
{
test: /\.png$/
loader: "url-loader?prefix=img/&mimetype=image/png"
}
{
test: /\.jpg$/
loader: "url-loader?prefix=img/&mimetype=image/jpg"
}
{
test: /\.gif$/
loader: "url-loader?prefix=img/&mimetype=image/gif"
}
]
resolve:
extensions: ['', '.webpack.js', '.web.js', '.coffee', '.js', '.json', '.jade', '.html', '.less', '.css']
modulesDirectories: ['src', 'src/js', 'web_modules', 'bower_components', 'node_modules']
root: [path.join(__dirname, "src")]
alias:
# config: 'json/config-local'
routes: 'json/routes'
industries: 'json/industries'
colors: 'json/colors'
constants: 'json/constants'
countries: 'json/countries'
router: 'coffee/router/router'
navbar: 'coffee/view/widget/navbar-widget'
footer: 'coffee/view/widget/footer-widget'
config: 'coffee/manager/config-manager'
network: 'coffee/manager/network-manager'
sync: 'coffee/manager/sync-manager'
auth: 'coffee/manager/auth-manager'
storage: 'coffee/manager/storage-manager'
permission: 'coffee/manager/permission-manager'
toast: 'coffee/manager/toast-manager'
tracking: 'coffee/manager/tracking-manager'
me: 'coffee/model/me-model'
util: 'coffee/helper/util'
redirect: 'coffee/helper/redirect'
baseCollection: 'coffee/base/base-collection'
baseModel: 'coffee/base/base-model'
baseManager: 'coffee/base/base-manager'
baseView: 'coffee/base/base-view'
baseFormPageView: 'coffee/base/base-form-page-view'
baseRouter: 'coffee/base/base-router'
baseSingleton: 'coffee/base/base-singleton'
bootstrapCss: 'bootstrap/dist/css/bootstrap.min'
fontawesomeCss: 'font-awesome/css/font-awesome.min'
bootstrapJs: 'bootstrap/dist/js/bootstrap.min'
# bootstrapAffix: 'bootstrap/js/affix'
# bootstrapAlert: 'bootstrap/js/alert'
# bootstrapButton: 'bootstrap/js/button'
# bootstrapCarousel: 'bootstrap/js/carousel'
bootstrapCollapse: 'bootstrap/js/collapse'
bootstrapDropdown: 'bootstrap/js/dropdown'
bootstrapModal: 'bootstrap/js/modal'
bootstrapPopover: 'bootstrap/js/popover'
# bootstrapScrollspy: 'bootstrap/js/scrollspy'
# bootstrapTab: 'bootstrap/js/tab'
bootstrapTooltip: 'bootstrap/js/tooltip'
bootstrapTransition: 'bootstrap/js/transition'
moment: 'momentjs'
store: 'store.js'
timezone: 'jsTimezoneDetect'
intlTelInputJs: 'intl-tel-input/build/js/intlTelInput.min'
intlTelInputCss: 'intl-tel-input/build/css/intlTelInput'
timepicker: 'brenwell-timepicker/js/bootstrap-timepicker'
timepickerCss: 'bootstrap-3-timepicker/css/bootstrap-timepicker.min.css'
spin: 'spinjs/spin.js' # keep this an jspin
jspin: 'spinjs/jquery.spin.js' #add jquery support to spin.js
toastrCss: 'toastr/toastr.min.css'
toastrJs: 'toastr/toastr.min.js'
|
add this to your config: node: {
fs: "empty"
} |
Worked! Thanks alot @zalad |
…ack.config to avoid fs problem : pugjs/pug-loader#8
+1 |
Can someone please explain what does the above config do? |
@omerts I can try but the question seems a little broad, is there something specific about it you wish to understand? |
@brenwell how does it solve the problem, does it cause webpack to mock the fs module during compilation time? Is there any doc about such configs? |
Not sure about any docs, but yes I believe this creates an empty module for fs. |
@brenwell ok thank you :) |
Worked! Thanks alot @zalad |
I don't understand why I'm getting this error, because I'm only using the |
@zalad, Where to add that code and how to add that code ? |
@afoysal in case anyone is still confused. it should be added like: var config = {
node: {
fs: "empty"
}
} |
I have already added that code but unfortunately I am still having the same error. Below is my code module.exports = {
} |
@omerts (just my guess) setting |
This can also be fixed on library level. The library using "browser": {
"fs": false
} to say: "For browser build I don't need the |
I solved with: |
When I do this and ▼ {}
⯆ __proto__:
⯈ constructor: ƒ Object()
⯈ __defineGetter__: ƒ __defineGetter__()
⯈ __defineSetter__: ƒ __defineSetter__()
⯈ hasOwnProperty: ƒ hasOwnProperty()
⯈ __lookupGetter__: ƒ __lookupGetter__()
⯈ __lookupSetter__: ƒ __lookupSetter__()
⯈ isPrototypeOf: ƒ isPrototypeOf()
⯈ propertyIsEnumerable: ƒ propertyIsEnumerable()
⯈ toString: ƒ toString()
⯈ valueOf: ƒ valueOf()
⯈ toLocaleString: ƒ toLocaleString()
⯈ get __proto__: ƒ __proto__()
⯈ set __proto__: ƒ __proto__() Is this caused by the 'empty' keyword? For reference, I'm using an electron-aurelia-webpack ES6 set-up. |
Hey there, thanks for the loader,
I get the following warning when running Webpack with this loader.
I think found a possible solution which I think you actually gave @sokra. https://gitter.im/webpack/webpack/archives/2014/08/26 looks like you need to add
"browser": { "fs": false }
https://github.com/kangax/fabric.js/blob/master/package.json#L17-L21
Could be alos that I screwed something up, thanks in advance for any help
The text was updated successfully, but these errors were encountered: