-
Notifications
You must be signed in to change notification settings - Fork 162
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
Module parse failed: Unexpected character '#' (1:0) with Create React App #60
Comments
It seems like I just need to exclude // Process JS with Babel.
{
test: /\.(js)$/,
include: paths.appNodeModules + '/opener/opener.js',
loader: [require.resolve('shebang-loader'), require.resolve('babel-loader')],
},
{
test: /\.(js|jsx|mjs)$/,
include: paths.appSrc,
exclude: paths.appNodeModules + '/opener/opener.js',
loader: require.resolve('babel-loader'),
options: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
}, |
I think the problem here might be that |
I tried removing
Is this a dependency of AppAuth JS? |
|
According to
|
Ah.. So it's a dependency of import closure from 'rollup-plugin-closure-compiler-js';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
export default {
input: 'built/src/index.js',
output: {
file: 'built/app-bundle.js',
format: 'iife',
name: 'app',
globals: {'crypto': 'crypto'},
sourcemap: true
},
external: ['crypto'],
plugins: [
replace({'process.env.NODE_ENV': JSON.stringify('production')}),
nodeResolve({jsnext: true, main: true}),
commonjs(),
closure({createSourceMap: true}),
]
}; And use something like: node_modules/.bin/tsc && node_modules/.bin/rollup --config config/rollup/prod.js My "devDependencies": {
"npm": "^6.0.0",
"rollup": "^0.58.2",
"rollup-plugin-closure-compiler-js": "^1.0.6",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-watch": "^4.3.1",
"typescript": "^2.8.3"
} |
I was able to use electron-builder to package the sample for production and prove it works. The problem is centered around CRA. I'd be a very happy camper if I was able to make the When I tried to port my app from CRA to be in the appauth-js-electron-sample, I had to change everything to use TypeScript (and JXS). The TypeScript stuff went OK, but trying to figure out Babel and JSX proved frustrating. Ideally, it'd be possible to modify my existing app to somehow work with |
I find trying to keep up with all the changes in I will add documentation and sample code around how one can build I will also investigate on what I should be doing to make |
Closing this for now. Will investigate using Webpack, and update this thread. |
I am facing this error in an angular-electron application. I started using the starter from this repository: Included AppAuth-js as dependency and I am facing this error. ng eject is disabled in current version of angular cli so I cannot modify webpack loader to remove Is there any other step I should take to get rid of this error? |
@zkewal I have same error. Did you find workaround? |
I was able to successfully modify the appauth-js-electron-sample app to log in with my identity provider. Now I'm trying to integrate it into a React + Electron app I created with Create React App. After adding this library and code, I get a strange error when I run
npm run build
, which runsreact-scripts build
.Expected Behavior
My React project still builds just like the example app does.
Describe the problem
Once I add the following
AuthService.js
tosrc
directory and reference it in another class, the error starts happening. This class is very similar to the sample's flow.ts, except that it's written in JavaScript and supports PKCE.[REQUIRED] Actual Behavior
Compile error.
[REQUIRED] Steps to reproduce the behavior
I created a GitHub repo to show this issue: https://github.com/mraible/appauth-react-electron.
Steps to reproduce:
git clone https://github.com/mraible/appauth-react-electron.git
npm i && npm run build
src/Login.js
to remove all references toAuthService
npm run build
and everything will compile OK[REQUIRED] Environment
The text was updated successfully, but these errors were encountered: