ajainvivek/preact-fluid

not working with preact-cli generated app

Closed this issue · 10 comments

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"
    }
  }
}

I will try to look into this, would be great if you could create a repo.

thanks

I think there is an issue and I was able to replicate this.

in the mean time can you use:

import Button from 'preact-fluid/src/Button';

I will try to figure out what happened.

@ajainvivek

Seems like /lib isn't being pushed to npm:

screen shot 2018-03-25 at 20 36 01

We need to do a release to ensure the lib folder is pushed to npm .

@ajainvivek if we can do a patch release that would be great. The issue is covered here for why lib wasn't being pushed`.

my npm username: sabeurthabti if you want to grant me deploy access.

We should consider adding circle-ci ?

Any updates on this issue?

import Button from 'preact-fluid/src/Button';

will provide the following error:

Module parse failed: Unexpected token (1:20)
You may need an appropriate loader to handle this file type.
| export default from './Button';```

@nicolasbettag I don't have npm access to deploy the package. I will await @ajainvivek and we can then proceed.

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

@nicolasbettag @azulkipli I have pushed a release:

+ preact-fluid@0.6.0

Please let me know if you experience any new issues.

Thanks.

@sabeurthabti works like a charm! 🚀

@ajainvivek I will also investigate it.