Categories
Mastering Development

stylus-loader with postcss

So, have a Vue app, would like to use Stylus, however I’m also using PostCSS with the postcssPresetEnv plugin, and I’m having trouble getting the two to cooperate. I started with using poststylus, like so const postcssPresetEnv = require(‘postcss-preset-env’); module: { rules : [ …, { test: /\.styl(us)?$/, use: [‘vue-style-loader’, ‘css-loader’, ‘stylus-loader’] }, ] }, […]

Categories
Mastering Development

webpack watch not working on osx – how to fix?

Changes in my index.js aren’t being reflected in realtime on my browser. My config: const path = require(“path”); const MonacoWebpackPlugin = require(“monaco-editor-webpack-plugin”); module.exports = { mode: process.env.NODE_ENV, entry: “./index.js”, output: { path: path.resolve(__dirname, “dist”), filename: “[name].bundle.js”, }, module: { rules: [{ test: /\.css$/, use: [“style-loader”, “css-loader”,], }, { test: /\.ttf$/, use: [‘file-loader’] }], }, plugins: […]

Categories
Cryptocurrency Development Ethereum

webpack packing website and upload to ipfs but node_modules not found

After webpacking the website, I upload the dist folder to ipfs. The ethereum part is working fine, however no js files (except for app.js) and node modules can be found. But as you can see in the pics, they are right there. When I use “npm run dev” to run the website, everything is working […]

Categories
Mastering Development

Running webpack build issue while trying to create a React application using babel, webpack

I am working on a new project set up for react using webpack and babel. Following is the webpack.config.js file Folder structure: node_modules/ src/ – api/ – components/ – index.jsx – stats.html webpack.config.js babel.config.js const path = require(‘path’); const MiniCssExtractPlugin = require(‘mini-css-extract-plugin’); const { BundleAnalyzerPlugin } = require(‘webpack-bundle-analyzer’); const { ContextReplacementPlugin, HashedModuleIdsPlugin } = require(‘webpack’); […]

Categories
Development

You may need an appropriate loader to handle this file type error occurs in ReactJS file

I have divided my configuration in to two production and development mode and merging them using webpack-merge. Whenever i try to build or run the code it gives me you may need an appropriate loader error even though i have define loader for the jsx or js files. Common Config File code is here… const […]

Categories
Development

Hot reloading not being trigger – component malformed?

This has been baffling me for a few hours now & I can’t seem to work out why. My original theory was that react-router/redux was causing this issue but I have now stripped them out & hot reloading still does not occur. My original file structure is below: index.js import ‘@babel/polyfill’ import React from ‘react’ […]

Categories
Development

React router 4 url issue

import React from ‘react’; import { Router, Route, Switch } from ‘react-router-dom’; import { history } from ‘./history’; import Login from ‘./components/Login’; import Home from ‘./components/Home’; import NotFound from ‘./presentation/NotFound’; import MainContent from ‘./components/MainContent’; import Overview from ‘./components/Overview’; export default () => { return( <Router history ={history}> <Switch> <Route path=”/” component={Login} exact /> <Home> <Route […]

Categories
Development

Why does webpack omit my .css code from the generated .css bundle when I change mode from `development` to `production`?

Context I have a React application laid out using the project directory structure shown below. It makes uses of a whole tree of .scss files, and a single bar.css file, used to support a third party component. The bar.css file is referenced by a single .jsx file (which uses the third party component), like so: […]

Categories
Cryptocurrency Development Ethereum

Getting error -> unexpected token. You may need an appropriate loader to handle this file type

root@kali:~/Documents/oraclize-test# npm run dev truffle-oraclize-api@0.0.2 dev /root/Documents/oraclize-test webpack-dev-server ERROR in ./app/javascripts/app.js Module parse failed: /root/Documents/oraclize-test/app/javascripts/app.js Unexpected token (124:0) You may need an appropriate loader to handle this file type. | }) | } | @ multi (webpack)-dev-server/client?http://localhost:8081 ./app/javascripts/app.js webpack: Failed to compile. APP.JS // Import the page’s CSS. Webpack will know what to do with […]

Categories
Development

“Plugin/Preset files are not allowed to export objects, only functions” with Webpack & Babel

Here is the error I am getting. This is different from other similar questions because every bloody project is different and there isn’t a cure-all solution just because some lousy algorithm says my question is similar to another question, Just because the questions are similar does not mean the solutions are identical!!! ERROR in ./client/index.js […]