.css Module parse failed - reactjs

Installed Rodal modals for React but when i add
import 'rodal/lib/rodal.css';
i get an error -> "ERROR in ./~/rodal/lib/rodal.css
Module parse failed"
Looking around it appears to be a babel.config.js issues but even when copying some of other peoples answers, the problem persists.
Below is the babel.config.js file
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: 'babel', query: { presets: ['react', 'es2015', 'stage-1'] } },
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};
Add package.json
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"repository": "",
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
"test:watch": "npm run test -- --watch"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.23.0",
"chai": "^3.5.0",
"chai-jquery": "^2.0.0",
"css-loader": "^0.26.2",
"jquery": "^2.2.1",
"jsdom": "^8.1.0",
"mocha": "^2.4.5",
"npm": "^4.3.0",
"react-addons-test-utils": "^0.14.7",
"style-loader": "^0.13.2",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"axios": "^0.15.3",
"babel-preset-stage-1": "^6.1.18",
"classnames": "^2.2.5",
"flexboxgrid": "^6.3.1",
"lodash": "^3.10.1",
"material-design-icons": "^3.0.1",
"material-ui": "^0.17.0",
"next": "^2.0.0-beta",
"react": "^15.4.2",
"react-carousel": "^3.3.0",
"react-dom": "^15.4.2",
"react-flexbox-grid": "^0.10.2",
"react-instantsearch": "^3.2.1",
"react-instantsearch-theme-algolia": "^3.2.1",
"react-redux": "^4.0.0",
"react-router": "^3.0.2",
"react-slick": "https://github.com/johntron/react-slick/archive/0.14.6-patch.tar.gz",
"react-tap-event-plugin": "^2.0.1",
"redux": "^3.0.4",
"redux-promise": "^0.5.3",
"rodal": "^1.4.0"
}
}
The component calling it is
import React, { Component } from 'react';
import Rodal from 'rodal';
import 'rodal/lib/rodal.css';
export default class ModalButton extends Component {
render () {
return (
<div>
<h2>Hello</h2>
</div>
);
}
}
EDIT: Working Version for anyone else who needs this.
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [
{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-1']
}
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
},
resolve: {
extensions: ['', '.js', '.jsx', '.css']
},
devServer: {
historyApiFallback: true,
contentBase: './'
}
};

Your error means that webpack does not know how to parse css files.
To resolve this problem you need to npm install --save-dev style-loader css-loader and in your webpack file include those loaders as follows
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: 'babel', query: { presets: ['react', 'es2015', 'stage-1'] } },
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
}
and include .css extension
resolve: {
extensions: ['', '.js', '.jsx', '.css']
}

Related

Error while configuring webpack 4 in my react (create-react-app) project

i am configuring the webpack 4 in my react project (create-react-app)
i have installed all the require loaders/file to configure my webpack, but there is always some different error, (some time its about sass-loader/css-loader/style-loader)
Now am dealing with (eot,woff,woff2,ttf) files error.
i don't know, i am conflicting the versions of node-sass/webpack/loaders or what.
please help me to configuring webpack in my project.
i am attaching the configuration files and errors screen.
Here is my devdependencies in my package-json file.
"devDependencies": {
"#babel/core": "^7.17.9",
"#babel/preset-env": "^7.16.11",
"#babel/preset-react": "^7.16.7",
"babel-loader": "^8.2.5",
"css-loader": "^3.6.0",
"file-loader": "^6.2.0",
"laravel-echo": "^1.11.2",
"less": "^4.1.2",
"less-loader": "^5.0.0",
"node-sass": "^4.14.1",
"pusher-js": "^7.0.3",
"raw-loader": "^4.0.2",
"react-error-overlay": "6.0.9",
"sass": "^1.51.0",
"sass-loader": "^7.1.0",
"style-loader": "^1.3.0",
"ts-loader": "^9.2.8",
"url-loader": "^4.1.1",
"webpack": "^4.42.0",
"webpack-cli": "^4.9.2"
}
webpack.config.js file
const path = require("path");
module.exports = {
mode: "production",
entry: "./src/index.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
publicPath: "/dist/",
},
// ...add the babel-loader and preset
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
// {
// test: /\.(scss|css|sass)$/,
// use: ["sass-loader", "style-loader", "css-loader"],
// },
{
test: /\.(scss|css|sass)$/,
use: [
// style-loader
{
loader: "style-loader",
},
// css-loader
{
loader: "css-loader",
options: {
modules: true,
},
},
// sass-loader
{
loader: "sass-loader",
options: {
modules: true,
},
},
],
},
{
test: /\.(woff2|woff|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
// options: {
// name: "[name].[ext]",
// outputPath: "fonts/",
// },
},
],
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: "file-loader",
},
],
},
],
},
// ...add resolve to .jsx extension
resolve: {
extensions: ["*", ".js", ".jsx"],
},
};
.babelrc
{
"presets": ["#babel/preset-env", "#babel/preset-react"]
}
Kindly check your themes scss and comment imports one by one and try to make build. In my case scss files were causing issues.

How to remove source maps from webpack 5 #React.js #webpack 5

The common solution for removing source maps from a CRA build is to add "GENERATE_SOURCEMAPS=false react-scripts build" in package.json build scripts and/or "GENERATE_SOURCEMAPS=false" in the CRA .env file. However, I do not use Create React App. Therefore, "react-scripts build" is not recognized as an internal command, my .env file has no effect on the bundled code, and simply adding "GENERATE_SOURCEMAPS=false" to my build scripts does nothing. I would like to remove source maps from the webpack bundle. Here is my package.json.
{
"name": "reactboilerplate",
"version": "1.0.0",
"description": "boilerplate code",
"main": "index.js",
"presets":
[
"#babel/preset-env",
"#babel/preset-react"
],
"scripts":
{
"build": "cross-env GENERATE_SOURCEMAP=false webpack --watch",
"start": "webpack serve",
"build-prod": "weback -p",
"winBuild": "set \"GENERATE_SOURCEMAP=false\" && build"
},
"keywords": [],
"author": "ziggy",
"license": "NONE",
"devDependencies":
{
"#babel/core": "^7.16.7",
"#babel/preset-env": "^7.16.8",
"#babel/preset-react": "^7.16.7",
"babel-loader": "^8.2.3",
"css-loader": "^6.5.1",
"file-loader": "^6.2.0",
"html-loader": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"node-polyfill-webpack-plugin": "^1.1.4",
"style-loader": "^3.3.1",
"webpack": "^5.66.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.3"
},
"dependencies":
{
"#aws-amplify/ui-react": "^2.1.9",
"aws-amplify": "^4.3.12",
"aws-amplify-react": "^5.1.9",
"bootstrap": "^5.1.3",
"pandadoc-node-client": "^4.1.0",
"react": "^17.0.2",
"react-bootstrap": "^2.1.1",
"react-dom": "^17.0.2",
"typewriter-effect": "^2.18.2"
}
}
Here is my webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/index.js',
output:
{
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve:
{
modules: [path.join(__dirname, 'src'), 'node_modules'],
alias: { react: path.join(__dirname, 'node_modules', 'react') }
},
plugins:
[
new NodePolyfillPlugin(),
new HtmlWebpackPlugin({ template: './src/index.html' }),
],
module:
{
rules: [
{
test: /\.css/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
use:
{
loader: "babel-loader",
options:
{
presets: ['#babel/preset-env', '#babel/preset-react']
}
}
},
{
test: /\.(png|mp4)$/i,
type: "asset/resource"
},
{
test: /\.txt$/i,
type: 'asset/source'
},
{
test: /\.(woff|woff2|ttf)$/i,
type: "asset/resource"
},
{
test: /\.html$/,
use: ["html-loader"]
},
{
test: /\.(mov|mp4)$/,
use:
[
{
loader: 'file-loader',
options:
{
name: '[name].[ext]'
}
}
]
},
{
test: /\.m?js/,
resolve:
{
fullySpecified: false
}
},
]
}
}

Webpack-Dev-Server: Errors while compiling. Reload prevented. (Stack: React)

I use React with Webpack-Dev-Server for local Development.
Every now and then I get this error:
"react_devtools_backend.js:6 [WDS] Errors while compiling. Reload prevented."
After the error occurs, no code-change is being updated on the browser.
package.json:
"devDependencies": {
"#babel/core": "^7.9.6",
"#babel/plugin-transform-runtime": "^7.9.6",
"#babel/preset-env": "^7.9.6",
"#babel/preset-react": "^7.9.4",
"#material-ui/core": "^4.10.0",
"babel-loader": "^8.1.0",
"css-loader": "^3.5.3",
"file-loader": "^6.0.0",
"lodash": "^4.17.15",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"}
"dependencies": {
"#material-ui/styles": "^4.9.14",
"clsx": "^1.1.0"}
webpack.config.js:
module.exports = {
mode: "development",
entry: "./src/main.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["#babel/preset-env", "#babel/preset-react"],
plugins: ["#babel/plugin-transform-runtime"],
},
},
},
{
test: /\.css$/,
exclude: /node_modules/,
loader: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: "file-loader",
},
],
},
],
},
devServer: {
contentBase: path.join(__dirname, "dist"),
},
};
This issue seems to happen with eslint-loader where hot module replacement is used along with emitWarning: false (which is the default value):
This is how I fixed it (just added emitWarning option and set to true):
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
emitWarning: true,
},
},
Docs here: https://github.com/webpack-contrib/eslint-loader#emitwarning-default-false

Require JS Compile React application

I am working on React JS application. While building the code using grunt build I am getting the below error:
Running "requirejs:compile" (requirejs) task
Error: Cannot uglify file: C:/Dev/first-research/first-research-min.js.
Skipping it. Error is:
SyntaxError: Unexpected token: name (ClassicEditor)
If the source uses ES2015 or later syntax, please pass "omptimize: 'none'" to r.js
and use an ES2015+ compatible minifier after running r.js. The included
UglifyJS only understands ES5 or earlier syntax.
Calling webpack configuration from grunt to build and transpile from es6 to es5.
Attached are the Webpack, grunt, package.json and babel.rc file for ref
Webpack file
const path = require('path'),
webpack = require('webpack'),
MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { styles } = require( '#ckeditor/ckeditor5-dev-utils' );
process.env.NODE_ENV = 'development';
module.exports = {
optimization: {
splitChunks: {
cacheGroups: {
styles: {
name: 'app',
test: /\.css$/,
chunks: 'all',
enforce: true
}
}
}
},
mode: 'development',
entry: {
'app': './src/app'
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.scss', '.css'],
modules: ['./node_modules']
},
output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name]-bundle.js',
libraryTarget: 'amd'
},
module: {
rules: [
{
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: [ 'raw-loader' ]
},
{ // To process CKEditor CSS files.
test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
use: [
{
loader: 'style-loader',
options: {
singleton: true
}
},
{
loader: 'postcss-loader',
options: styles.getPostCssConfig( {
themeImporter: {
themePath: require.resolve('#ckeditor/ckeditor5-theme-lark')
},
minify: true
} )
}
]
},
// ESlint loader
{
test: /\.(js|jsx)$/, // include .js and .jsx files
use: [
'eslint-loader'
],
enforce: 'pre',
exclude: /node_modules/ // exclude any and all files in the node_modules folder
},
// ES6 loader
{
test: /\.(js|jsx)$/,
exclude: /node_modules/, // exclude any and all files in the node_modules folder
use: {
loader: 'babel-loader',
options:{
presets: ['env']
}
}
},
// Style loader other than CK5 editor CSS files.
{
test: /\.css$/,
exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
},
{
test: /\.scss$/,
exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.scss/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000
}
}]
},
// html loader
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
minimize: true,
}
}]
},
{
loader: require.resolve('file-loader'),
// Exclude `js` files to keep the "css" loader working as it injects
// its runtime that would otherwise be processed through the "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpack's internal loaders.
exclude: [
/\.(js|jsx|mjs)$/,
/\.html$/,
/\.json$/,
/ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
/(node_modules)/,
/\.css$/
],
options: {
name: 'static/media/[name].[hash:8].[ext]'
}
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name]-bundle.css',
}),
new webpack.LoaderOptionsPlugin({ options: {} }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb/)
// new CKEditorWebpackPlugin( {
// language: 'pl'
// })
],
externals: [
/^user-profile/, //OK
/^settings\/settings/, //OK
/^am-permissions\/permission/, //OK
/^logger\/log/, //OK
/^am-permissions/, //OK
/^am-address/, //OK
/^am-alerter/, //OK
/^amfx-blotter-grid\//, //OK
/^amfx-blotter-grid-components\//, //OK
/^amfx-blotter-filters\//, //OK
/^amfx-react-components\//, //OK
/^menu\//, //OK
'react', //OK
'react-dom', //OK
'prop-types', //OK
/^jquery$/, //OK:
/^underscore$/, //OK:
/^lodash$/,
/^q$/, //OK:
/^d3$/, //OK:
/^text/, //OK:
/^d3-utils\//, //OK:
/^bootstrap\//, //OK:
/^moment$/, //OK:
/^am-modal\//, //OK
/^xhr-client\//, //OK
/^q\//, //OK
/^whatwg-fetch\//, //OK
'immutable', //OK
/^amfx-tab\//, //OK
/^fx-blotter\//, //OK
/^zap-tab-comms\//, //OK
/^trade-operations\// //OK
],
devtool: 'source-map',
resolveLoader: {
alias: {
'css/css': 'style-loader'
}
}
};
package.json
{
"name": "first-research",
"version": "0.1.18",
"description": "first-research: Built using the Zambezi Platform",
"main": "dist/react-your-component-name.min.js",
"repository": {
"type": "git",
"url": "https://stash.dts.fm.rbsgrp.net/scm/amfirstresearch/first-research.git"
},
"scripts": {
"build": "webpack --progress --watch --config ./config/webpack.dev.js",
"test": "jest"
},
"devDependencies": {
"#ckeditor/ckeditor5-dev-utils": "^10.0.3",
"#ckeditor/ckeditor5-theme-lark": "^11.0.0",
"babel": "^6.1.18",
"babel-core": "^6.14.0",
"babel-eslint": "^6.1.0",
"babel-jest": "^15.0.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-es2015-node5": "^1.2.0",
"babel-preset-react": "^6.11.1",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^6.6.1",
"cross-env": "^1.0.8",
"css": "^1.0.7",
"css-loader": "^0.28.7",
"eslint": "^3.7.0",
"eslint-config-airbnb": "^10.0.1",
"eslint-loader": "^1.5.0",
"eslint-plugin-import": "^1.13.0",
"eslint-plugin-jsx-a11y": "^2.1.0",
"eslint-plugin-react": "^6.1.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"grunt": "^1.0.3",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-requirejs": "^1.0.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-webpack": "^3.0.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^15.1.1",
"jest-static-stubs": "^0.0.1",
"lodash": "^4.17.10",
"mini-css-extract-plugin": "^0.4.1",
"moment": "^2.22.2",
"postcss-loader": "^3.0.0",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "^15.3.1",
"react-test-renderer": "^15.3.1",
"rimraf": "^2.5.4",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^4.16.5",
"webpack-merge": "^4.1.0",
"zambezi-contrib-build": "^2.1.3"
},
"dependencies": {
"#ckeditor/ckeditor5-adapter-ckfinder": "^10.0.2",
"#ckeditor/ckeditor5-autoformat": "^10.0.2",
"#ckeditor/ckeditor5-basic-styles": "^10.0.2",
"#ckeditor/ckeditor5-block-quote": "^10.0.2",
"#ckeditor/ckeditor5-build-classic": "^11.0.1",
"#ckeditor/ckeditor5-dev-webpack-plugin": "^6.0.3",
"#ckeditor/ckeditor5-easy-image": "^10.0.2",
"#ckeditor/ckeditor5-editor-classic": "^11.0.0",
"#ckeditor/ckeditor5-essentials": "^10.1.1",
"#ckeditor/ckeditor5-heading": "^10.0.2",
"#ckeditor/ckeditor5-image": "^10.2.0",
"#ckeditor/ckeditor5-link": "^10.0.3",
"#ckeditor/ckeditor5-list": "^11.0.1",
"#ckeditor/ckeditor5-paragraph": "^10.0.2",
"#ckeditor/ckeditor5-react": "^1.0.0-beta.1",
"#zambezi/sdk": "^5.19.1",
"axios": "^0.18.0",
"enzyme": "^3.3.0",
"es6-promise": "^4.2.4",
"isomorphic-fetch": "^2.2.1",
"prop-types": "^15.6.2",
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-modal": "^3.5.1",
"react-router-dom": "^4.3.1",
"react-tabs": "^2.2.2"
},
"_zambezi": {
"runtimeDependencies": [
"am-address",
"am-alerter",
"am-permissions",
"react",
"react-dom",
"css",
"lodash",
"prop-types"
]
},
"jest": {
"collectCoverage": true,
"moduleNameMapper": {
"^.+\\.(png|jpg|gif)$": "jest-static-stubs/$1",
"^.+\\.(eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy",
"^.+\\.(css|less)$": "identity-obj-proxy"
}
}
}
Grunt file
module.exports = function (grunt) {
grunt.initConfig({
build: {
options: {
optimize: 'none',
include: ['first-research'],
plugins: {
'css/css': '../node_modules/css/css',
'settings/settings': 'empty:',
"am-permissions/permission": "empty:",
"user-profile/user-profile": "empty:",
"logger/log": "empty:"
}
}
},
webpack: {
dev: require('./config/webpack.dev.js'),
prod: require('./config/webpack.prod.js')
},
watch: {
files: ['src/**/*.js'],
tasks: ['webpack:dev', 'build']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('zambezi-contrib-build');
grunt.registerTask('default', ['webpack:dev', 'build']);
grunt.registerTask('ci-build', ['webpack:prod', 'build']);
};
babel.rc
{
"presets": [
"stage-0",
"react",
"es2015-node5"
],
"plugins": [
"transform-class-properties"
],
"sourceMaps": true
}

ReactDOM issue: Module not found: Error: Cannot resolve module 'react/lib/ReactDOM'

I just restarted my computer and now when I try to run my React project locally I get this error. Before restarting I was able to work on my project just fine. I tried removing my node_modules folder and npm installing again, still not working. Anybody have any ideas what my problem could be? Here is my package.json and webpack.config:
package.json:
{
"version": "1.0.0",
"description": "== README",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Stefan",
"license": "ISC",
"dependencies": {
"babel-core": "6.18.2",
"babel-loader": "6.2.7",
"babel-preset-es2015": "6.18.0",
"babel-preset-react": "6.16.0",
"css-loader": "0.26.1",
"file-loader": "0.9.0",
"less": "2.3.1",
"less-loader": "2.2.3",
"react": "15.4.1",
"react-addons-test-utils": "15.4.1",
"react-dom": "15.3.2",
"react-fontawesome": "1.5.0",
"react-redux": "4.4.5",
"react-router": "3.0.0",
"redux": "3.6.0",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
"webpack": "1.13.3"
}
}
webpack.config:
module.exports = {
context: __dirname,
entry: "./frontend/app.jsx",
output: {
path: "app/assets/javascripts",
filename: "bundle.js",
publicPath: "/assets/"
},
resolve: {
extensions: ["", ".js", ".jsx"]
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
},{
test: /\.node$/,
loader: "node-loader"
},{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file"
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml"
}
]
},
devtool: 'source-map',
};

Resources