Comments (6)
I don't guess that's the reason because, if I remove everything inside .modernizrrc (just leave {} ), webpack runs perfectly
Nevertheless, your loader configuration for Modernizr would not apply to the provided file because the regex does not match. The error message
Unexpected token (2:10)
You may need an appropriate loader to handle this file type.
is, at least in my experience, almost everytime caused by a "falsy" loader configuration. So there might be an issue there which is not caused by the modernizr-loader itself.
I cloned your repo and it happens to be that webpack is not recognizing your .modernizrrc
as a json
file. If you pass in the json-loader
into your configuration like so
{
test: /\.modernizrrc/,
loader: 'modernizr-loader!json-loader'
},
it should run successfully.
However, I thought that webpack@2
is capable of reading json
files. Maybe @jhnns has some input here. It might be due to the alias
.
from modernizr-loader.
Webpack 2 will only apply the json-loader by default if the file extension is .json
from modernizr-loader.
I had a typo in the webpack.config.js resolve
but it didn't fixed the issue.
.../Webpack2Setup/webpack.config.js (FIXED)
...
resolve: {
alias: {
modernizr$: __dirname + "/.modernizrrc"
}
},
...
New error
ERROR in ./.modernizrrc
Module parse failed: .../Webpack2Setup/.modernizrrc Unexpected token (2:10)
You may need an appropriate loader to handle this file type.
| {
| "minify": false,
| "options": [
| "setClasses"
from modernizr-loader.
Hey! This might be due to your loader configuration. You are expecting a /\.modernizrrc.js$/
, but you are aliasing modernizr
to .modernizrrc
.
from modernizr-loader.
I don't guess that's the reason because, if I remove everything inside .modernizrrc
(just leave {} ), webpack runs perfectly
from modernizr-loader.
@flootr you're right, I just needed to update the loader: 'modernizr-loader!json-loader'
That's a good question because I read somewhere that I didn't need json-loader
with webpack 2. Probably I don't need to install it (I don't have it on my package.json) but I have to pass it into my configuration.
Thank you for your help 😄
from modernizr-loader.
Related Issues (20)
- the code `delete window.Modernizr` will throw an error in IE8 HOT 1
- Config from readme gives "path is not defined" HOT 2
- The modernizr-loader does not work with karma-webpack HOT 3
- Module build failed HOT 6
- Error in webpack Build HOT 26
- Error when parsing modernizrrc HOT 5
- Uncaught TypeError: _modernizr2.default.mq is not a function HOT 2
- json-loader is not required for webpack v2 and above HOT 1
- SyntaxError: Unexpected token : HOT 17
- specific chunk
- Pleas update npm docs!
- Add support for webpack 4 HOT 11
- [Docs] Installing modernizr package
- detection of keyframes does not work HOT 1
- No Such File or Directory HOT 1
- Build errors: dependencies not found HOT 2
- Is this project deprecated? HOT 4
- Dependency not found
- Not working with webpack@^5.0.0 HOT 5
- modernizr-loader does not work with json5-loader@4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modernizr-loader.