question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not working with preact-cli generated app

See original GitHub issue

I generated default template using preact-cli, install preact-fluid, import component but it said

✖ ERROR ./src/components/header/index.js
Module not found: Error: Can't resolve 'preact-fluid' in '/Users/azul/Sites/preactfluid/src/components/header'
 @ ./src/components/header/index.js 13:0-38
 @ ./src/components/app.js
 @ ./src/index.js
 @ ./node_modules/preact-cli/lib/lib/entry.js
 @ multi ./node_modules/preact-cli/lib/lib/entry webpack-dev-server/client webpack/hot/dev-server

my header component

import { h, Component } from "preact";
import { Link } from "preact-router/match";
// import style from './style';

import { Button } from "preact-fluid";

export default class Header extends Component {
  render() {
    return <Button>Hello World</Button>;
  }
}

my package.json

{
  "private": true,
  "name": "preactfluid",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev",
    "build": "preact build",
    "serve": "preact build && preact serve",
    "dev": "preact watch",
    "lint": "eslint src",
    "test": "jest ./tests"
  },
  "eslintConfig": {
    "extends": "eslint-config-synacor"
  },
  "eslintIgnore": [
    "build/*"
  ],
  "devDependencies": {
    "eslint": "^4.9.0",
    "eslint-config-synacor": "^2.0.2",
    "identity-obj-proxy": "^3.0.0",
    "if-env": "^1.0.0",
    "jest": "^21.2.1",
    "preact-cli": "^2.1.0",
    "preact-render-spy": "^1.2.1"
  },
  "dependencies": {
    "preact": "^8.2.6",
    "preact-compat": "^3.17.0",
    "preact-fluid": "^0.5.8",
    "preact-router": "^2.5.7"
  },
  "jest": {
    "verbose": true,
    "setupFiles": [
      "<rootDir>/src/tests/__mocks__/browserMocks.js"
    ],
    "testURL": "http://localhost:8080",
    "moduleFileExtensions": [
      "js",
      "jsx"
    ],
    "moduleDirectories": [
      "node_modules"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/tests/__mocks__/fileMock.js",
      "\\.(css|less|scss)$": "identity-obj-proxy",
      "^./style$": "identity-obj-proxy",
      "^preact$": "<rootDir>/node_modules/preact/dist/preact.min.js",
      "^react$": "preact-compat",
      "^react-dom$": "preact-compat",
      "^create-react-class$": "preact-compat/lib/create-react-class",
      "^react-addons-css-transition-group$": "preact-css-transition-group"
    }
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nicolasbettagcommented, Apr 24, 2018

@sabeurthabti works like a charm! 🚀

1reaction
ajainvivekcommented, Apr 24, 2018

@sabeurthabti you can publish changes now. We can have a look into adding circle-ci, I will try playing around it in coming days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App doesn't render properly with preact build --no-prerender
When I inspected the header element in browser, all the DOM elements in header do not have any classes, hence the styles are...
Read more >
Getting Started | Preact: Fast 3kb React alternative with the ...
This guide helps you get up and running to start developing Preact apps, using 3 popular options. If you're new to Preact, we...
Read more >
preact build does not work when Webpack 5 is installed
After giving this a day and researching it with fresh eyes, I found that this is simply not possible yet; the preact-cli team...
Read more >
preact-cli | Yarn - Package Manager
preact -cli. owner preactjs39.4kMIT3.4.3TS vulns 30 vulnerabilities. Start building a Preact Progressive Web App in seconds. preact, cli, pwa, project ...
Read more >
Building a Small PWA with Preact and Firebase - Dan Denney
Sass support requires a flag, so after installing the CLI, I ran preact create app --sass and then dragged the files out to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found