picker icon indicating copy to clipboard operation
picker copied to clipboard

Build package for web use without config

Open Naturalclar opened this issue 5 years ago • 4 comments

build commonjs and module files so this package can be used in web without modifying webpack config

write something like following so source file would be used in react-native

  "main": "lib/commonjs/index.js",
  "react-native": "src/index.tsx",
  "source": "src/index.tsx",
  "module": "lib/module/index.js",

Naturalclar avatar Apr 03 '21 03:04 Naturalclar

I have the same problem. Indeed, files from the js/ folder have a .js extension, but use Typescript, Flow and ES6 features that webpack needs to compile.

I can't figure out how I can make this happen, has anyone else the same problem?

pybuche avatar Apr 26 '21 17:04 pybuche

@pybuche I am using the react-native-picker-select library and was running into the same issue. I used the transform-flow-strip-types plugin with the babel loader on a few of the files and it fix the build error for me. Hopefully this helps you too.

module: {
  rules: [
    /// other rules
    {
      test: /react-native-(picker|web)(-select)?.*\.jsx?$/,
      use: {
        loader: 'babel-loader',
        options: {
          plugins: [
            '@babel/plugin-proposal-class-properties',
            'transform-flow-strip-types'
          ]
        }
      }
    }
  ]
}

sternetj avatar May 27 '21 14:05 sternetj

:tada: This issue has been resolved in version 2.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Naturalclar avatar Sep 11 '21 09:09 Naturalclar

:tada: This issue has been resolved in version 2.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Naturalclar avatar Sep 11 '21 11:09 Naturalclar