Closed demurgos closed 5 years ago
If you want to use yarn, please try with
npx create-cycle-app hello-cycle --yarn
Thank you for you quick response. I wasn't aware of this flag.
I reinstalled it in a clean directory. I ran the following commands:
npx create-cycle-app hello-cycle --yarn
cd hello-cycle
yarn run build
It leads to the same error:
ERROR in ./src/css/styles.scss
Module build failed (from ./node_modules/extract-text-webpack-plugin/dist/loader.js):
ModuleParseError: Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type.
> html {
| width: 100%;
| height: 100%; }
at handleParseError (/data/projects/hello-cycle/node_modules/webpack/lib/NormalModule.js:447:19)
at doBuild.err (/data/projects/hello-cycle/node_modules/webpack/lib/NormalModule.js:481:5)
at runLoaders (/data/projects/hello-cycle/node_modules/webpack/lib/NormalModule.js:342:12)
at /data/projects/hello-cycle/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/data/projects/hello-cycle/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/data/projects/hello-cycle/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /data/projects/hello-cycle/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/data/projects/hello-cycle/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.render [as callback] (/data/projects/hello-cycle/node_modules/sass-loader/lib/loader.js:76:9)
at Object.done [as callback] (/data/projects/hello-cycle/node_modules/neo-async/async.js:8077:18)
at options.success (/data/projects/hello-cycle/node_modules/node-sass/lib/index.js:308:32)
@ ./src/css/styles.scss
ERROR in ./src/css/styles.scss 1:5
Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type.
> html {
| width: 100%;
| height: 100%; }
@ multi ./src/index.ts ./src/css/styles.scss main[1]
I tried to eject the config but it still fails. I am currently attaching breakpoints and checking the webpack config exported by configs/webpack.config.js
. I found module.rules[2].test
to be [/^.*\.scss$/, /^.*\.sass$/]
. I believe that this means that these extensions are recognized (but still not properly handled).
I am still trying to attach breakpoints inside Webpack. It seems that Sass properly converts from SCSS to CSS (the last line of the stack trace is from Sass' success calback). The issue seems to be that the CSS result is then parsed as JS.
Found the issue: https://github.com/andywer/webpack-blocks/pull/298
Thank you for the link.
I checked the PR and changes they made to their test cases, then applied them to my ejected webpack config. The following changes fixed my issue:
- const { file, url } = require('@webpack-blocks/assets');
+ const { css, file, url } = require('@webpack-blocks/assets');
# ...
match(
['*.scss', '*.sass'],
[
+ css(),
sass({
includePaths: [appPath('node_modules')],
sourceMap: true
}),
postcss({
plugins: [autoprefixer({ browsers: ['last 2 versions'] })]
}),
env('production', [extractText('[name].[hash].css')])
]
),
Could you test it yourself and publish a fix to npm? Maybe you need to pass some options to css()
? Maybe to handle sourcemaps?
I released 7.2.1 fixing the issue
Thank you very much. I will try it out.
Hi, I am interested in using
cycle.js
but both thestart
andbuild
commands fail due toscss
. I created a new app withcreate-cycle-app
, reinstalled the dependencies with yarn and tried to run it.Here are the repro steps:
Here is the error I get with
start
:Here is the error I get with
build
:I am not familiar with Webpack so I don't know what is happening exactly. It seems that it treats
.scss
files as if they were Javascript.