You may need an appropriate loader to handle this file type with react@15.4.2, webpack@2.2.1 and babel-loader@6.2.10
See original GitHub issueWebpack Version: 2.2.1
Babel Core Version: 6.22.1
Babel Loader Version: 6.2.10
Please tell us about your environment: Linux
Current behavior:
it gives an error You may need an appropriate loader to handle this file type with
Expected/desired behavior: no error
//package.json
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "^2.0.0-rc.2",
"html-webpack-plugin": "^2.28.0",
"node-sass": "^4.5.0",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"sass-loader": "^4.1.1",
"style-loader": "^0.13.1",
"uglifyjs-webpack-plugin": "^0.1.2",
"webpack": "^2.2.1"
//webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin'),
UglifyJSPlugin = require('uglifyjs-webpack-plugin'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
path = require("path");
module.exports = {
"entry": ["./app/index.js"],
"output": {
"path": "output",
"filename": "[name]-[chunkhash].js",
"libraryTarget": "umd"
},
"module": {
rules: [
{
"exclude": "/node_modules/",
"include": "./app/",
"loader": "babel-loader",
"options": {
"presets": ["es2015", "react"]
},
"test": /\.jsx?$/
},
{
"exclude": "/node_modules/",
"use": ExtractTextPlugin.extract({
"fallbackLoader": "style-loader",
"loader": ["css-loader", "sass-loader"]
}),
"test": /\.scss$/
}
]
},
plugins: [
new HtmlWebpackPlugin(),
new ExtractTextPlugin("[name]-[contenthash].css")
]
}
//./app/index.js
let React = require("react"),
ReactDom = require("react-dom");
ReactDom.render(
<div id="root"></div>,
document.getElementsByTagName("body")
);
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:37 (4 by maintainers)
Top Results From Across the Web
"You may need an appropriate loader to handle this file type ...
js file is doing is importing react, but it seems like the 'babel-loader' is not working. I am using 'babel-loader' 6.0.0. javascript ·...
Read more >You may need an appropriate loader to handle this file type ...
I 'm having a problem configuring Webpack for Typescript and React. After running the NPM script: webpack serves ./webpack/webpack.config.ts ...
Read more >"You may need an appropriate loader to handle this file type ...
[Solved]-Webpack error: "You may need an appropriate loader to handle this file type"-Reactjs. Search. score:2. { test : /\.(js|jsx)$/, include : APP_DIR, ...
Read more >Fast Inline Images With React and Webpack - Request Metrics
Webpack is great for building React applications, but did you know it can help you ... (1:0) You may need an appropriate loader...
Read more >Using Webpack with React, Pt. 1 - Toptal
There are other types of resources that we might need in a React application, which we will cover in the following sections. CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If I had to guess, you want
to be
or
paths have to be absolute paths, or regexes.
@Bijayini Your test values are a string value, which means they won’t match during the test resolution. You can switch to: