Last active
August 8, 2017 12:58
-
-
Save OzTK/a17647d1e501b74e68a7d13d48f2cef8 to your computer and use it in GitHub Desktop.
Multiple entries webpack configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import '../elm-src/styles/HomePageStylesheets'; | |
| const ElmHome = require("../elm-src/Home.elm"); | |
| ElmUsers.Home.embed(document.getElementById("app"), context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| port module HomePageStylesheets exposing (..) | |
| import Css.File exposing (CssFileStructure, CssCompilerProgram) | |
| import MainStyle | |
| import UsersStyle | |
| port files : CssFileStructure -> Cmd msg | |
| fileStructure : CssFileStructure | |
| fileStructure = | |
| Css.File.toFileStructure | |
| [ ( "main.css", Css.File.compile [ MainStyle.css ] ) | |
| , ( "home.css", Css.File.compile [ HomeStyle.css ] ) | |
| ] | |
| main : CssCompilerProgram | |
| main = | |
| Css.File.compiler files fileStructure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import '../elm-src/styles/UsersPageStylesheets'; | |
| const ElmUsers = require("../elm-src/Users.elm"); | |
| ElmUsers.Users.embed(document.getElementById("app"), context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| port module UsersPageStylesheets exposing (..) | |
| import Css.File exposing (CssFileStructure, CssCompilerProgram) | |
| import MainStyle | |
| import UsersStyle | |
| port files : CssFileStructure -> Cmd msg | |
| fileStructure : CssFileStructure | |
| fileStructure = | |
| Css.File.toFileStructure | |
| [ ( "main.css", Css.File.compile [ MainStyle.css ] ) | |
| , ( "users.css", Css.File.compile [ UsersStyle.css ] ) | |
| ] | |
| main : CssCompilerProgram | |
| main = | |
| Css.File.compiler files fileStructure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| export = { | |
| entry: { | |
| shared: ['./client/src/shared.js'], | |
| users: ['./client/src/users.js'] | |
| }, | |
| resolve: { | |
| extensions: ['.js', '.elm'] | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /(?!styles)\.elm$/, | |
| exclude: [/elm-stuff/, /node_modules/], | |
| use: ['elm-webpack-loader?verbose=true&warn=true'] | |
| }, | |
| { test: /\.css$/, | |
| use: [ 'style-loader', 'css-loader' ], | |
| exclude: /node_modules/ | |
| }, | |
| { | |
| test: /HomePageStylesheets\.elm$/, | |
| exclude: [/elm-stuff/, /node_modules/ ], | |
| use: [ 'style-loader', 'css-loader', 'elm-css-webpack-loader?module=HomePageStylesheets' ] | |
| }, | |
| { | |
| test: /UsersPageStylesheets\.elm$/, | |
| exclude: [/elm-stuff/, /node_modules/ ], | |
| use: [ 'style-loader', 'css-loader', 'elm-css-webpack-loader?module=UsersPageStylesheets' ] | |
| } | |
| ], | |
| noParse: [/((?!styles).)*\.elm.*$/] | |
| }, | |
| plugins: [/* Your plugins */], | |
| output: { | |
| filename: 'javascripts/[chunkhash].[name].js', | |
| path: path.resolve(__dirname, 'public'), | |
| publicPath: '/' | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment