Expected Behavior
I expect to be able to use semantic-ui-less and load it's related files via config.next.js webpack rules and plugins.
Current Behavior
Context
I'm hitting some walls myself with my next.config.js to use webpack to load all semantic-ui-less related files...
`
const { WebpackBundleSizeAnalyzerPlugin } = require('webpack-bundle-size-analyzer')
const { ANALYZE } = process.env
// const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
webpack: function (config) {
config.module.rules.push({
test: /.less$/,
use: [
{ loader: 'style-loader', options: { } },
{ loader: 'css-loader', options: { } },
{ loader: 'less-loader', options: { } },
]
})
config.module.rules.push({
test: /.jpe?g$|.gif$|.png$|.ttf$|.eot$|.svg$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}]
})
config.module.rules.push({
test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/,
use: [{
loader: 'url-loader',
options: {
limit: '10000',
mimetype: 'application/fontwoff'
}
}]
})
// config.plugins.push(
// new ExtractTextPlugin({
// filename: "[name].[contenthash].css",
// disable: process.env.NODE_ENV === "development"
// })
// )
if (ANALYZE) {
config.plugins.push(
new WebpackBundleSizeAnalyzerPlugin('stats.txt')
)
}
return config
}
}
`
Depending on the order of the less loaders I get different errors...
style, css, less
`Unexpected token &
/Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less:14
& { @import "definitions/globals/reset"; }
^
SyntaxError: Unexpected token &
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
at Module._compile (/Users/agustif/Documents/Git/cruceritis/node_modules/source-map-support/source-map-support.js:492:25)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)`
less-style-css
`Error in semantic-ui-less/semantic.less
Module build failed:
// load the styles
var content = require("!!../css-loader/index.js??ref--6-2!./semantic.less");
^
Unrecognised input
in /Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less (line 4, column 12)`
css-less-style
`Error in semantic-ui-less/semantic.less
Module build failed:
// load the styles
var content = require("!!./semantic.less");
^
Unrecognised input
in /Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less (line 4, column 12)`
css-style-less
`Error in semantic-ui-less/semantic.less
Module build failed: Unknown word (5:1)
3 | // load the styles
4 | var content = require("!!../less-loader/dist/cjs.js??ref--6-2!./semantic.less");
5 | if(typeof content === 'string') content = [[module.id, content, '']];
| ^
6 | // Prepare cssTransformation
7 | var transform;
8 | `
"dependencies": { "next": "^4.1.4", "react": "^16.1.1", "react-dom": "^16.1.1", "semantic-ui-react": "^0.77.0" }, "devDependencies": { "css-loader": "^0.28.7", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^1.1.5", "find-in-files": "^0.4.0", "less": "^2.7.3", "less-loader": "^4.0.5", "ncp": "^2.0.0", "semantic-ui-less": "^2.2.12", "style-loader": "^0.19.0", "url-loader": "^0.6.2", "webpack-bundle-size-analyzer": "^2.7.0" } }
My Environment
| Tech |
Version |
| next |
4.1.4 |
| node |
8.7.0 |
| OS |
macOS High Sierra 10.13.1 |
| browser |
Chrome |
| react |
16.1.1 |
Expected Behavior
I expect to be able to use semantic-ui-less and load it's related files via config.next.js webpack rules and plugins.
Current Behavior
Context
I'm hitting some walls myself with my next.config.js to use webpack to load all semantic-ui-less related files...
`
const { WebpackBundleSizeAnalyzerPlugin } = require('webpack-bundle-size-analyzer')
const { ANALYZE } = process.env
// const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
webpack: function (config) {
config.module.rules.push({
test: /.less$/,
use: [
{ loader: 'style-loader', options: { } },
{ loader: 'css-loader', options: { } },
{ loader: 'less-loader', options: { } },
]
})
config.module.rules.push({
test: /.jpe?g$|.gif$|.png$|.ttf$|.eot$|.svg$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}]
})
config.module.rules.push({
test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/,
use: [{
loader: 'url-loader',
options: {
limit: '10000',
mimetype: 'application/fontwoff'
}
}]
})
// config.plugins.push(
// new ExtractTextPlugin({
// filename: "[name].[contenthash].css",
// disable: process.env.NODE_ENV === "development"
// })
// )
}
}
`
Depending on the order of the less loaders I get different errors...
style, css, less
`Unexpected token &
/Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less:14
& { @import "definitions/globals/reset"; }
^
SyntaxError: Unexpected token &
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
at Module._compile (/Users/agustif/Documents/Git/cruceritis/node_modules/source-map-support/source-map-support.js:492:25)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)`
less-style-css
`Error in semantic-ui-less/semantic.less
Module build failed:
// load the styles
var content = require("!!../css-loader/index.js??ref--6-2!./semantic.less");
^
Unrecognised input
in /Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less (line 4, column 12)`
css-less-style
`Error in semantic-ui-less/semantic.less
Module build failed:
// load the styles
var content = require("!!./semantic.less");
^
Unrecognised input
in /Users/agustif/Documents/Git/cruceritis/node_modules/semantic-ui-less/semantic.less (line 4, column 12)`
css-style-less
`Error in semantic-ui-less/semantic.less
Module build failed: Unknown word (5:1)
3 | // load the styles
4 | var content = require("!!../less-loader/dist/cjs.js??ref--6-2!./semantic.less");
"dependencies": { "next": "^4.1.4", "react": "^16.1.1", "react-dom": "^16.1.1", "semantic-ui-react": "^0.77.0" }, "devDependencies": { "css-loader": "^0.28.7", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^1.1.5", "find-in-files": "^0.4.0", "less": "^2.7.3", "less-loader": "^4.0.5", "ncp": "^2.0.0", "semantic-ui-less": "^2.2.12", "style-loader": "^0.19.0", "url-loader": "^0.6.2", "webpack-bundle-size-analyzer": "^2.7.0" } }My Environment