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
Webpack - Uncaught TypeError: fs.readFileSync is not a function #2078
Comments
Duplicate of #1854? |
It's similar , but now the problem is why set
It all work fine , but don't like #1854 , it shows In addition ,
If I remove but same issue |
I don't know anything about webpack. You need to have a transform that resolves the readFileSyncs into the actual strings of the file like the browserify transform does. |
Here is my working webpack.config: var webpack = require("webpack");
var path = require("path");
var config = {
target: "web",
debug: true,
devtool: "source-map",
entry: {
main: "./source/scripts/main"
},
output: {
path: "./build",
filename: "[name].bundle.js",
chunkFilename: "[id].bundle.js"
},
node: { // this is for pixi.js
fs: "empty"
},
resolve: {
modulesDirectories: ['web_modules', 'bower_components', 'node_modules']
},
module: {
loaders: [
{ test: /\.css/, loader: "style-loader!css-loader" },
{ test: /\.less$/, loader: "style-loader!css-loader!less-loader" },
{ test: /\.jsx?$/, exclude: /(node_modules|bower_components)/, loader: 'babel?optional[]=runtime&stage=0'},
{ test: /\.png/, loader: "url-loader?limit=100000&mimetype=image/png" },
{ test: /\.gif/, loader: "url-loader?limit=100000&mimetype=image/gif" },
{ test: /\.jpg/, loader: "file-loader" },
{ test: /\.json/, loader: "json-loader" },
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
]
},
plugins: [
//new webpack.optimize.UglifyJsPlugin(),
//new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
__DEV__: true
})
]
};
module.exports = config; |
CLosing as solved. |
This is the most direct and simple example of configuring webpack with PIXI that I found. |
Maybe related issues with PIXI through Webpack pixijs/pixijs#1854 pixijs/pixijs#2078 Where they set node: { fs: "empty" }
I recommend updating the Many (most?) other popular client-side libs reference the built files in package.json to prevent problemos like this. |
It works with browserify out of the box, as well as webpack with the proper config. Webpack themselves recommend that you do not point to the built file, but instead to the source and configure the proper transforms. Likely in the future we will try to use more "webpack-friendly" transforms, or include the config necessary in our package json so you don't have to write it (like we do for browserify). But saying it doesn't work with popular builders out of the box is just not true at all, webpack is the only one you need a bit of config to get working. |
@supermrji it doesn't work out of the box with webpack. |
Cannot understand, how this issue was solved finally? Got same problem when trying to use soap from within react application. |
@aasten I´ve the same problem with soap and VUE-CLI ... do you have solved it? |
@Crawler158 no, sorry. |
nothing? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Webpack.config.js
It's show
Uncaught TypeError: fs.readFileSync is not a function
If I remove
It goes
Uncaught Error: Cannot find module "fs"
in my main script
main.js
I found it when use
new PIXI.filters.BlurFilter()
but if i use
https://cdnjs.cloudflare.com/ajax/libs/pixi.js/3.0.7/pixi.min.js"
cdn linkIt's all ok .
Does any option for Wepack need to set ?
The text was updated successfully, but these errors were encountered: