Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following instruction but cannot get amplify-ui to run #4641

Closed
apekkar opened this issue Nov 6, 2023 · 2 comments
Closed

Following instruction but cannot get amplify-ui to run #4641

apekkar opened this issue Nov 6, 2023 · 2 comments
Labels
question General question

Comments

@apekkar
Copy link

apekkar commented Nov 6, 2023

I feel stupid because I cannot get this running by following the instructions
Is there some prerequisites that I am missing here or something?

First I did these:
https://docs.amplify.aws/start/getting-started/setup/q/integration/js/

I can get the web page running with npm run

Then I headed to:
https://ui.docs.amplify.aws/react/getting-started/installation
and
https://ui.docs.amplify.aws/react/getting-started/usage

and tried npm run with following error:

> [email protected] start
> webpack && webpack-dev-server --mode development

asset main.bundle.js 41.1 KiB [emitted] (name: main)
asset index.html 1.67 KiB [compared for emit] [from: index.html] [copied]
runtime modules 26.5 KiB 9 modules
./src/app.js 223 bytes [built] [code generated] [1 error]

ERROR in ./src/app.js 6:9
Module parse failed: Unexpected token (6:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| function App() {
>   return <Button variation="primary">Hello world</Button>;
| }
|

webpack 5.89.0 compiled with 1 error in 55 ms

I tried adding the loader for css as instructed but no help

My webpack.config.js:

const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');

module.exports = {
  mode: 'development',
  entry: './src/app.js',
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/
      },
      { 
        test: /\.css$/,
        use: [
            { loader: 'style-loader', options: { singleton: true } },
            { loader: 'css-loader', options: { importLoaders: 1, sourceMap: true } }
        ],
      }
    ]
  },
  devServer: {
    client: {
      overlay: true
    },
    hot: true,
    watchFiles: ['src/*', 'index.html']
  },
  plugins: [
    new CopyWebpackPlugin({
      patterns: ['index.html']
    }),
    new webpack.HotModuleReplacementPlugin()
  ]
};
@github-actions github-actions bot added the pending-triage Issue is pending triage label Nov 6, 2023
@reesscot
Copy link
Contributor

reesscot commented Nov 8, 2023

@apekkar Unless you have previous experience, I wouldn't recommend setting up webpack by yourself (sorry that guide mislead you, we'll get that updated). The errors you are running into have to do with JSX support. Please take a look at our Next or Vite Getting Started guides:
https://ui.docs.amplify.aws/react/getting-started/usage/nextjs
https://ui.docs.amplify.aws/react/getting-started/usage/vite
Next and Vite require no additional configuration to support React.

Let us know if that helps!

@reesscot reesscot added pending-response question General question and removed pending-triage Issue is pending triage labels Nov 8, 2023
@reesscot
Copy link
Contributor

We've updated the guide, so I'm closing out this ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question
Projects
None yet
Development

No branches or pull requests

2 participants